请问如何在此代码中在程序名称/版本和徽标之间设置空格?我正在使用pygtk。谢谢

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"))

最佳答案

我想这有点怪异,但这可行:

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()


将徽标和程序名称之间要添加的像素数更改为100。

关于python - 程序名/版本和徽标之间的python aboutdialog空间,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7163858/

10-13 05:10