[英]wxPython wxBitmapButton with Icon + Label
How to get it work? 如何运作? I tried to create Button with Icon and Label on it.
我试图创建带有图标和标签的Button。 Like these buttons:
像这些按钮:
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))
It creates some button with icon on it well. 它很好地创建了一个带有图标的按钮。 But, how to add a label on it?
但是,如何在上面添加标签?
I read in docs, that BitmapButton inherits from Button, which has SetLabel() method. 我在文档中读到,BitmapButton继承自Button,后者具有SetLabel()方法。 I've try
我尝试过
self.button1.SetLabel("Continue")
but nothing. 但是什么都没有。 Button with Icon only.
仅带有图标的按钮。
What I do wrong? 我做错了什么?
In wx.lib.buttons
you get ThemedGenBitmapTextButton
class for a button containing both an image and text. 在
wx.lib.buttons
您将获得包含图像和文本的按钮的ThemedGenBitmapTextButton
类。 There are more button classes in that lib. 该库中有更多按钮类。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.