我正试图获得带有图像和标签的按钮,并没有成功.我可以使用标签或图像的按钮,但不能同时使用.这是我的代码部分:
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")
Run Code Online (Sandbox Code Playgroud)
任何的想法 ?谢谢