Changes between Version 5 and Version 6 of waue/2009/1126


Ignore:
Timestamp:
Nov 26, 2009, 5:44:23 PM (15 years ago)
Author:
waue
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • waue/2009/1126

    v5 v6  
    55細部的格式分libgrade 與 gtkbuilder ,此範例是用 libgrade。
    66
    7  == ui.glade  ( libgrade ) ==
     7 = libgrade  =
     8
     9 == ui.glade (libgrade 的xml )==
    810
    911{{{
     
    129131
    130132
    131 = 補充 =
     133= GTKBuilder =
    132134
    133135 * GTKBuilder 為通用格式,libglade也可轉換為此格式
    134136
     137 == gtkbuilder 的xml格式 ==
    135138{{{
    136139#!xml
     
    139142</interface>
    140143}}}
     144
     145 == python 引用方法 ==
     146
     147{{{
     148#!python
     149
     150import pygtk
     151pygtk.require("2.0")
     152import gtk
     153class 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}}}