【问题标题】:what's wrong with this image on a wx.boxsizerwx.boxsizer 上的这张图片有什么问题
【发布时间】:2013-01-07 23:44:08
【问题描述】:

想要一个 boxsizer,左边有一个图像(可能会改变),右边有一个标签。所以我创建了这段代码,但它有问题,但我不明白为什么。我是python新手,感谢理解。

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)。

谢谢

【问题讨论】:

    标签: image python-2.7 wxpython boxsizer


    【解决方案1】:

    这就是答案:

    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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-02
      • 1970-01-01
      • 1970-01-01
      • 2017-01-29
      • 1970-01-01
      • 1970-01-01
      • 2011-10-19
      相关资源
      最近更新 更多