コード例 #1
0
ファイル: writing_pad.py プロジェクト: 2050utopia/hwr
    def __init__(self, find_method=None):
        self.find_method = find_method

        # window
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        self.window.connect("delete_event", self.delete_event)
        self.window.connect("destroy", self.destroy)
        self.window.set_border_width(10)
        self.window.set_resizable(False)

        # find button
        self.find_button = gtk.Button(stock=gtk.STOCK_FIND)
        self.find_button.connect("clicked", self.canvas_find)

        # undo button
        self.undo_button = gtk.Button(stock=gtk.STOCK_UNDO)
        self.undo_button.connect("clicked", self.canvas_undo)

        # clear button
        self.clear_button = gtk.Button(stock=gtk.STOCK_CLEAR)
        self.clear_button.connect("clicked", self.canvas_clear)

        # vbox
        self.vbox = gtk.VBox()
        self.vbox.pack_start(self.find_button)
        self.vbox.pack_start(self.undo_button)
        self.vbox.pack_start(self.clear_button)

        # canvas
        self.canvas = Canvas()
        self.canvas.set_size_request(300, 300)

        # hbox
        self.hbox = gtk.HBox(spacing=5)
        self.hbox.pack_start(self.canvas, expand=False)
        self.hbox.pack_start(self.vbox, expand=False)

        # result label
        self.label = gtk.Label()

        # final vbox
        self.fvbox = gtk.VBox(spacing=3)
        self.fvbox.pack_start(self.hbox)
        self.fvbox.pack_start(gtk.HSeparator())
        self.fvbox.pack_start(self.label)

        self.window.add(self.fvbox)
        self.window.show_all()