example-1.py
来自「Developing with Gnome一书examples例子代码」· Python 代码 · 共 29 行
PY
29 行
#!/usr/bin/env python# This program displays a simple window and has a simple callback for# when the OK button is clicked.import gtkimport gtk.glade# libglade needs some way to lookup the handler functions; defining# them in a class provides an easy way to do thatclass GladeHandlers: def ok_button_clicked(ok_button): print "Thanks for trying out my program." gtk.main_quit() # No predefined helper functions exist--all must be manually declared. def gtk_main_quit(window, event): gtk.main_quit()# load the interfacemain_window = gtk.glade.XML('../example-1.glade')# connect the signals in the interfacemain_window.signal_autoconnect(GladeHandlers.__dict__)# start the event loopgtk.main()
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?