imagepython-2.7wxpythonboxsizer

what's wrong with this image on a wx.boxsizer


would like to have a boxsizer with an image (that may change) on the left and a label on the right. so i create this code, but there's something wrong with it, but i don't understand why. i'm a newbie on python, thanks for the comprehension.

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)

but i've this error,

TypeError: wx.Window, wx.Sizer, wx.Size, or (w,h) expected for item ERROR: Module: musicOrganizer could not be imported (file: /..../....py).

thanks


Solution

  • that's the answer:

    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)