Changes between Version 5 and Version 6 of waue/2009/1126
- Timestamp:
- Nov 26, 2009, 5:44:23 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
waue/2009/1126
v5 v6 5 5 細部的格式分libgrade 與 gtkbuilder ,此範例是用 libgrade。 6 6 7 == ui.glade ( libgrade ) == 7 = libgrade = 8 9 == ui.glade (libgrade 的xml )== 8 10 9 11 {{{ … … 129 131 130 132 131 = 補充=133 = GTKBuilder = 132 134 133 135 * GTKBuilder 為通用格式,libglade也可轉換為此格式 134 136 137 == gtkbuilder 的xml格式 == 135 138 {{{ 136 139 #!xml … … 139 142 </interface> 140 143 }}} 144 145 == python 引用方法 == 146 147 {{{ 148 #!python 149 150 import pygtk 151 pygtk.require("2.0") 152 import gtk 153 class TutorialApp(object): 154 def __init__(self): 155 builder = gtk.Builder() 156 builder.add_from_file("tutorial.xml") 157 builder.connect_signals({ "on_window_destroy" : gtk.main_quit }) 158 self.window = builder.get_object("window") 159 self.window.show() 160 161 if __name__ == "__main__": 162 app = TutorialApp() 163 gtk.main() 164 }}}