【发布时间】:2014-08-30 17:47:15
【问题描述】:
我正在尝试获取带有图像和标签的按钮,但没有成功。我可以有带有标签或图像的按钮,但不能两者兼有。 这是我的部分代码:
try:
pb = Pixbuf.new_from_file_at_size('myimg.jpg', 100, 100)
except:
pb = None
img = Gtk.Image()
img.set_from_pixbuf(pb)
button1 = Gtk.Button(xalign=0.5, yalign=1)
#button1.set_label(lbl)
button1.set_image(img)
button1.set_image_position(Gtk.PositionType.TOP)
button1.get_style_context().add_class("btn_article")
有什么想法吗? 谢谢
【问题讨论】:
标签: python image button label gtk3