Image 什么';What’wx.boxsizer上的图像有问题
想要一个左边有图像(可能会改变)右边有标签的boxsizer。所以我创建了这个代码,但是它有一些问题,但我不明白为什么。我是python的新手,谢谢你的理解Image 什么';What’wx.boxsizer上的图像有问题,image,python-2.7,wxpython,boxsizer,Image,Python 2.7,Wxpython,Boxsizer,想要一个左边有图像(可能会改变)右边有标签的boxsizer。所以我创建了这个代码,但是它有一些问题,但我不明白为什么。我是python的新手,谢谢你的理解 self.hFooterStatusImage = 'img/tick.png' self.jpg = wx.Image(self.hFooterStatusImage, wx.BITMAP_TYPE_PNG).ConvertToBitmap() self.hFooterStatusLabel = wx.StaticText(self.hP
self.hFooterStatusImage = 'img/tick.png'
self.jpg = wx.Image(self.hFooterStatusImage, wx.BITMAP_TYPE_PNG).ConvertToBitmap()
self.hFooterStatusLabel = wx.StaticText(self.hPanel, label = 'Ready')
self.hFooterBox = wx.BoxSizer(wx.HORIZONTAL)
self.hFooterBox.Add(self.jpg, 0, wx.ALL | wx.ALIGN_LEFT, 5)
self.hFooterBox.Add(self.hFooterStatusLabel, 0, wx.ALL | wx.ALIGN_LEFT, 5)
但我有一个错误
TypeError:wx.Window、wx.Sizer、wx.Size或(w,h)应为项目
错误:无法导入模块:musicOrganizer(文件:/../../...py)
谢谢这就是答案:
self.hFooterImagePanel = wx.Panel(self.hPanel, wx.ID_ANY)
self.hFooterImage = wx.StaticBitmap(self.hFooterImagePanel)
self.hFooterImage.SetBitmap(wx.Bitmap("img/tick.png"))
self.hFooterStatusLabel = wx.StaticText(self.hPanel, label = 'Ready')
self.hFooterBox = wx.BoxSizer(wx.HORIZONTAL)
self.hFooterBox.Add(self.hFooterImagePanel, 0, wx.ALL | wx.ALIGN_LEFT, 5)
self.hFooterBox.Add(self.hFooterStatusLabel, 0, wx.ALL | wx.ALIGN_LEFT, 5)