当前位置: 首页>>代码示例>>Python>>正文


Python Button.show方法代码示例

本文整理汇总了Python中gtk.Button.show方法的典型用法代码示例。如果您正苦于以下问题:Python Button.show方法的具体用法?Python Button.show怎么用?Python Button.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gtk.Button的用法示例。


在下文中一共展示了Button.show方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _GenDialog

# 需要导入模块: from gtk import Button [as 别名]
# 或者: from gtk.Button import show [as 别名]
class _GenDialog(gtkDialog):
    def __init__(self, name='GenDialog'):
        gtkDialog.__init__(self)
        self.set_name(name)
        self.ok_button = Button('ok', 'gtk-ok')
        self.ok_button.set_name(name)
        self.cancel_button = Button('cancel', 'gtk-cancel')
        self.cancel_button.set_name(name)
        self.action_area.pack_start(self.ok_button, TRUE, TRUE, 0)
        self.action_area.pack_end(self.cancel_button, TRUE, TRUE, 0)
        self.ok_button.show()
        self.cancel_button.show()
        self.cancel_button.connect('clicked', lambda *x : self.destroy())
        self._buttons_ = {}
        self.show()

    def set_ok(self, ok_fun):
        self.ok_button.connect('clicked', ok_fun)

    def set_cancel(self, cancel_fun):
        self.cancel_button.connect('clicked', cancel_fun)
        self.connect('destroy', cancel_fun)

    def add_button(self, name, func, label='foo'):
        if name not in self._buttons_.keys():
            self._buttons_[name] = Button(label)
            self._buttons_[name].show()
            self._buttons_[name].connect('clicked', func)
            self.action_area.add(self._buttons_[name])
开发者ID:BackupTheBerlios,项目名称:useless-svn,代码行数:31,代码来源:dialogs.py

示例2: UDBar

# 需要导入模块: from gtk import Button [as 别名]
# 或者: from gtk.Button import show [as 别名]
class UDBar(HBox):
    def __init__(self, name='UDBar'):
        HBox.__init__(self)
        self.set_name(name)
        self.ubutton = Button('update')
        self.dbutton = Button('diff')
        self.pack_start(self.ubutton, 0, 0, 0)
        self.pack_end(self.dbutton, 0, 0, 0)
        self.ubutton.show()
        self.dbutton.show()
        self.show()
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:13,代码来源:differ.py

示例3: TraitBar

# 需要导入模块: from gtk import Button [as 别名]
# 或者: from gtk.Button import show [as 别名]
class TraitBar(HBox):
    def __init__(self, name='TraitBar'):
        HBox.__init__(self)
        self.set_name(name)
        self.lcombo = MyCombo()
        self.rcombo = MyCombo()
        self.lcombo.set('')
        self.rcombo.set('')
        self.cbutton = Button('clear')
        self.cbutton.show()
        self.pack_start(self.lcombo, 0, 0, 0)
        self.pack_end(self.rcombo, 0, 0, 0)
        self.add(self.cbutton)
        self.show()
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:16,代码来源:differ.py

示例4: SuiteBar

# 需要导入模块: from gtk import Button [as 别名]
# 或者: from gtk.Button import show [as 别名]
class SuiteBar(HBox):
    def __init__(self, suites, name='SuiteBar'):
        HBox.__init__(self)
        self.set_name(name)
        self.lcombo = MyCombo(suites)
        self.lcombo.set(suites[0])
        self.rcombo = MyCombo(suites)
        self.rcombo.set(suites[0])
        self.ubutton = Button('update')
        self.dbutton = Button('diff')
        self.pack_start(self.lcombo, 0, 0, 0)
        self.pack_end(self.rcombo, 0, 0, 0)
        self.add(self.ubutton)
        self.add(self.dbutton)
        self.ubutton.show()
        self.dbutton.show()
        self.show()
开发者ID:BackupTheBerlios,项目名称:paella-svn,代码行数:19,代码来源:differ.py

示例5: do_dialog

# 需要导入模块: from gtk import Button [as 别名]
# 或者: from gtk.Button import show [as 别名]
class do_dialog(Window):

    def __init__(self, queues, icon):

        Window.__init__(self, WINDOW_TOPLEVEL)
        self.set_property("skip-taskbar-hint", True)
        self.set_property("destroy-with-parent", True)
        self.set_modal(True)
        self.connect("delete-event", self._stop_closing)
        self.set_position(WIN_POS_CENTER)

        self.set_icon(pixbuf_new_from_file(icon))
        self._setup_trees(queues)
        self._setup_layout()

        self.queues = queues

    def _setup_trees(self, queues):

        self._setup_install_tree(queues["add"])
        self._setup_remove_tree(queues["remove"])

    def _setup_install_tree(self, add_queue):

        self.inst_model = ListStore(str, str, str)

        for pac in add_queue:
            if pac.isold:
                image = "yellow"
            elif pac.installed:
                image = "green"
            else:
                image = "red"

            self.inst_model.append([image, pac.name, pac.version])
            continue

        self.inst_tree = TreeView()

        self.inst_tree.insert_column_with_attributes(-1, "",
                                                     CellRendererPixbuf(),
                                                     stock_id = 0)
        self.inst_tree.insert_column_with_attributes(-1, _("Package"),
                                                     CellRendererText(),
                                                     text = 1)
        self.inst_tree.insert_column_with_attributes(-1, _("Version"),
                                                     CellRendererText(),
                                                     text = 2)
        self.inst_tree.set_model(self.inst_model)

    def _setup_remove_tree(self, remove_queue):

        self.rem_model = ListStore(str, str, str)

        for pac in remove_queue:
            if pac.isold:
                image = "yellow"
            elif pac.installed:
                image = "green"
            else:
                image = "red"

            self.rem_model.append([image, pac.name, pac.inst_ver])
            continue

        self.rem_tree = TreeView()

        self.rem_tree.insert_column_with_attributes(-1, "",
                                                    CellRendererPixbuf(),
                                                    stock_id = 0)
        self.rem_tree.insert_column_with_attributes(-1, _("Package"),
                                                    CellRendererText(),
                                                    text = 1)
        self.rem_tree.insert_column_with_attributes(-1, _("Installed Version"),
                                                    CellRendererText(),
                                                    text = 2)

        self.rem_tree.set_model(self.rem_model)

    def _set_size (self, widget, event, data=None):
        if self.expander.get_expanded():
            self.size = self.get_size()
            self.expander.add(self.terminal)
            self.terminal.show()
        else:
            self.expander.remove(self.terminal)
            self.resize(self.size[0], self.size[1])
            self.show_all()

    def _setup_layout(self):

        self.hpaned = HPaned()
        self.hpaned.add1(self.inst_tree)
        self.hpaned.add2(self.rem_tree)
        self.hpaned.show_all()

        self.close_button = Button(stock=STOCK_CLOSE)
        self.close_button.connect("clicked", lambda _: self.destroy())

        self.terminal = terminal()
#.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:gtkpacman-svn,代码行数:103,代码来源:dialogs.py

示例6: Base

# 需要导入模块: from gtk import Button [as 别名]
# 或者: from gtk.Button import show [as 别名]
class Base(object):
    def __init__(self):
        from gtk import Window,WINDOW_TOPLEVEL,Button,Label,HBox,Entry,VBox,VSeparator
        self.window =  Window(WINDOW_TOPLEVEL)
        self.window.set_title("Slideshow")
        self.window.connect("delete_event", self.delete_event)
        self.window.set_border_width(10)
        self.vbox = VBox(False, 0)
        self.window.add(self.vbox)
        self.hbox1 = HBox(False, 0)
        self.vbox.pack_start(self.hbox1, True, True, 1)
        self.hbox = HBox(False, 0)
        self.vbox.pack_start(self.hbox, False, False, 1)
        self.hbox2 = HBox(False, 0)
        self.vbox.pack_start(self.hbox2, True, True, 1)
        self.label = Label('Identifikační číslo:')
        self.hbox.pack_start(self.label, False, False, 1)
        self.label.show()
        self.editable = Entry()
        self.editable.connect('key_press_event', self.key_press_event)
        self.hbox.pack_start(self.editable, True, True, 1)
        self.editable.show()
        self.button = Button("Začít")
        self.button.connect("clicked", self.callback)
        self.button.set_receives_default(True)
        self.button.set_can_focus(True)
        self.hbox.pack_start(self.button, False, False, 1)
        self.button.show()
        self.hbox1.show()
        self.hbox.show()
        self.hbox2.show()
        self.vbox.show()
        self.window.show()
    def delete_event(self, widget, event, data=None):
        gtk.main_quit()
        return False
    def key_press_event(self, widget, event):
        from gtk.gdk import keyval_from_name,keyval_name
        if event.keyval in (keyval_from_name('Return'),keyval_from_name('KP_Enter')):
            self.callback(widget)
    def _getFilePaths(self, fileTypes, recursive=True):
        import os
        import re
        from sys import argv
        pt = re.compile(r'.*([%(0)s][^%(0)s]*)'%{'0':os.path.extsep})
        path = [a for m,a in ((pt.match(os.path.basename(a)),a) for a in argv[1:]) if m and m.group(1) in fileTypes]
        if not path:
            path = '/home/pi/img/*.jpg'
        if isinstance(path, str):
            ## Returns list containing paths of files in /path/ that are of a file type in /fileTypes/,
            ##	if /recursive/ is False subdirectories are not checked.
            paths = []
            if recursive:
                for root, folders, files in os.walk(path, followlinks=True):
                    for file in files:
                        for fileType in fileTypes:
                            if file.endswith(fileType):
                                paths.append(os.path.join(root, file))
            else:
                for item in os.listdir(path):
                    for fileType in fileTypes:
                        if item.endswith(fileType):
                            paths.append(os.path.join(root, item))
            return paths
        elif iterable(path):
            return path
        else:
            return []
    def _init_cb(self,trans):
        from threading import Thread
        if not iterable(trans):
            trans = trans,
        callbacks  = []
        for name,cb in trans:
            t = Thread(target=cb, name='%sThread'%name)
            t.daemon = True
            t.start()
            callbacks.append(cb.enqueue)
        def wrap(msg):
            for cb in callbacks:
                if not cb(msg):
                    return False
            return True
        return wrap
    def callback(self, widget):
        from slideshow import SlideShow
        from trans import Message,GpioTransceiver,JsonTransceiver

        if not self.editable.get_text():
            return False
        img_cbs = self._init_cb([('ImgGpioCallback',GpioTransceiver(24)),('ImgJsonCallback',JsonTransceiver('img.json'))])
        kp_cbs = self._init_cb([('KpGpioCallback',GpioTransceiver(26,bcd=False)),('KpJsonCallback',JsonTransceiver('kp.json'))])
        def ordfnc(path):
            from numpy.random import permutation
            gray = path[0]
            result = []
            for p in permutation(path[1:]):
                result.append(p)
                result.append(gray)
            return result
#.........这里部分代码省略.........
开发者ID:pborky,项目名称:pyslides,代码行数:103,代码来源:startslideshow.py


注:本文中的gtk.Button.show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。