Changes between Version 4 and Version 5 of waue/2009/1126
- Timestamp:
- Nov 26, 2009, 5:36:37 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
waue/2009/1126
v4 v5 1 1 = glade 3 = 2 2 3 用glade 3可以幫助我們把程式介面畫出來,存檔的副檔名雖為glade,但為xml格式。 3 4 4 * libgrade (v) 5 細部的格式分libgrade 與 gtkbuilder ,此範例是用 libgrade。 6 7 == ui.glade ( libgrade ) == 5 8 6 9 {{{ … … 11 14 }}} 12 15 13 * GTKBuilder16 == python 部份程式碼 == 14 17 15 18 {{{ 16 #!xml 17 <interface> 18 <!-- interface-naming-policy project-wide --> 19 </interface> 19 #!python 20 #!/usr/bin/env python 21 import pygtk 22 import gtk 23 import gtk.glade 24 25 ... 26 27 class Example(): 28 29 def __init__(self): 30 self.ui_file=sys.path[0]+'/ui.glade' 31 self.widgetTree=gtk.glade.XML(self.ui_file,'window1') 32 dic={"on_exit_clicked":gtk.main_quit,\ 33 "on_window1_destroy":gtk.main_quit,\ 34 "on_XX_clicked":self.toXX,\ 35 "on_OO_clicked":self.toOO} 36 self.widgetTree.signal_autoconnect(dic) 37 20 38 }}} 21 39 40 41 === python範例的完整程式碼 === 22 42 23 43 {{{ … … 106 126 app.main() 107 127 }}} 128 129 130 131 = 補充 = 132 133 * GTKBuilder 為通用格式,libglade也可轉換為此格式 134 135 {{{ 136 #!xml 137 <interface> 138 <!-- interface-naming-policy project-wide --> 139 </interface> 140 }}}