【问题标题】:wxPython wxBitmapButton with Icon + LabelwxPython wxBitmapButton with Icon + Label
【发布时间】:2012-12-18 10:29:24
【问题描述】:

如何让它工作? 我试图创建带有图标和标签的按钮。喜欢这些按钮:

Like this example (image)

image1 = wx.Image("button_icon.png", wx.BITMAP_TYPE_ANY).ConvertToBitmap()
self.button1 = wx.BitmapButton(self.panel1, id=-1, bitmap=image1,
        pos=(10, 20), size = (200, image1.GetHeight()+5))

它很好地创建了一些带有图标的按钮。 但是,如何在上面添加标签?

我在文档中读到,BitmapButton 继承自具有 SetLabel() 方法的 Button。我试过了

self.button1.SetLabel("Continue")

但什么都没有。仅带图标的按钮。

我做错了什么?

【问题讨论】:

    标签: python button


    【解决方案1】:

    wx.lib.buttons 中,您将获得包含图像和文本的按钮的ThemedGenBitmapTextButton 类。该库中有更多按钮类。

    【讨论】:

      猜你喜欢
      • 2018-11-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-27
      • 1970-01-01
      • 2022-11-09
      • 2022-12-27
      • 1970-01-01
      相关资源
      最近更新 更多