开发者

python aboutdialog space between program name/version and logo

开发者 https://www.devze.com 2023-03-30 07:21 出处:网络
please how can i set space between program name/version and logo in this code? I am using pygtk. thanks

please how can i set space between program name/version and logo in this code? I am using pygtk. thanks

about = gtk.AboutDialog()
about.set_program_name("name")
about.set_version("0.0.1开发者_如何学编程")
about.set_logo(gtk.gdk.pixbuf_new_from_file("file.png"))


It's kind of hacky I suppose, but this works:

import gtk

about = gtk.AboutDialog()
about.set_program_name("name")
about.set_version("0.0.1")
about.set_logo(gtk.gdk.pixbuf_new_from_file("file.png"))
about.show()

vbox = about.get_children()[0].get_children()[0]  # vbox containing everything but the buttons at the bottom
label = vbox.get_children()[1] # Label containing name and version
alignment = gtk.Alignment(xalign=0.5, yalign=0.5)
alignment.set_padding(100, 0, 0, 0)
alignment.show()

vbox.remove(label)
alignment.add(label)
vbox.add(alignment)
vbox.reorder_child(alignment, 1)  # Put it back in the correct order, rather than below the URL and stuff

gtk.main()

Change 100 to the number of pixels you want to add between the logo and the program name.

0

精彩评论

暂无评论...
验证码 换一张
取 消