我使用经典代码example:
from gi.repository import Gtk
class Handler():
def onDeleteWindow(self, *args):
Gtk.main_quit(*args)
def on_button1_clicked(self, button):
print("Hello World!")
builder = Gtk.Builder()
builder.add_from_file("D:/temp/test1.glade")
builder.connect_signals(Handler())
window = builder.get_object("window1")
window.show_all()
Gtk.main()
一切都好。但是:
答案 0 :(得分:2)
在哪里/如何获得有关小部件的所有Python / Gtk信息,例如小部件属性名称?
https://lazka.github.io/pgi-docs/#Gtk-3.0
如何在事件中更改窗口小部件属性。就像点击它时更改button1标签一样。
button.set_label()
https://lazka.github.io/pgi-docs/#Gtk-3.0/classes/Button.html#Gtk.Button.set_label