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


Python Gtk.Button方法代码示例

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


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

示例1: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def __init__(self):
        Gtk.HeaderBar.__init__(self)

        self.search_btn = HeaderBarToggleButton("system-search-symbolic",
                                                _("Search"))
        self.add_btn = HeaderBarButton("list-add-symbolic",
                                       _("Add a new account"))
        self.settings_btn = HeaderBarButton("open-menu-symbolic",
                                            _("Settings"))
        self.select_btn = HeaderBarButton("object-select-symbolic",
                                          _("Selection mode"))

        self.cancel_btn = Gtk.Button(label=_("Cancel"))

        self.popover = None

        self._build_widgets() 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:19,代码来源:headerbar.py

示例2: _on_save

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def _on_save(self, *_):
        """
            Save Button clicked signal handler.
        """
        new_account = self.account_config.account
        username = new_account["username"]
        provider = new_account["provider"]
        old_provider = self._account.provider
        # Update the AccountRow widget
        self.emit("updated", username, provider)
        # Update the providers list
        if provider != old_provider:
            from .list import AccountsWidget
            ac_widget = AccountsWidget.get_default()
            ac_widget.update_provider(self._account, provider)
        self._on_quit() 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:18,代码来源:edit.py

示例3: __on_clear_database_clicked

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def __on_clear_database_clicked(self, *__):
        notification = Gd.Notification()
        notification.set_timeout(5)
        notification.connect("dismissed", self.__clear_database)
        container = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)

        notification_lbl = Gtk.Label()
        notification_lbl.set_text(_("The existing accounts will be erased in 5 seconds"))
        container.pack_start(notification_lbl, False, False, 3)

        undo_btn = Gtk.Button()
        undo_btn.set_label(_("Undo"))
        undo_btn.connect("clicked", lambda widget: notification.hide())
        container.pack_end(undo_btn, False, False, 3)

        notification.add(container)
        notification_parent = self.stack.get_child_by_name("behaviour")
        notification_parent.add(notification)
        notification_parent.reorder_child(notification, 0)
        self.show_all() 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:22,代码来源:settings.py

示例4: _build_widgets

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def _build_widgets(self):
        header_bar = Gtk.HeaderBar()
        header_bar.set_show_close_button(True)
        header_bar.set_title(_("GPG paraphrase"))
        apply_btn = Gtk.Button()
        apply_btn.set_label(_("Import"))
        apply_btn.get_style_context().add_class("suggested-action")
        apply_btn.connect("clicked", self.__on_apply)
        header_bar.pack_end(apply_btn)
        self.set_titlebar(header_bar)

        container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.paraphrase_widget = SettingsBoxWithEntry(_("Paraphrase"), True)
        container.pack_start(self.paraphrase_widget, False, False, 0)
        container.get_style_context().add_class("settings-main-container")
        self.add(container) 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:18,代码来源:gnupg.py

示例5: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def __init__(self, text="", icon_filename=""):

        Gtk.Button.__init__(self)

        apply_colours_to_widget(self)

        self.internal_box = Gtk.Box(spacing=10)
        self.internal_box.props.halign = Gtk.Align.CENTER
        self.add(self.internal_box)

        if icon_filename:
            self.icon = Gtk.Image.new_from_file(icon_filename)
            self.internal_box.pack_start(self.icon, False, False, 0)
            self.label = Gtk.Label(text)
            self.internal_box.pack_start(self.label, False, False, 0)
        else:
            self.label = Gtk.Label(text)
            self.internal_box.add(self.label)

        cursor.attach_cursor_events(self) 
开发者ID:KanoComputing,项目名称:kano-toolset,代码行数:22,代码来源:buttons.py

示例6: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def __init__(self, win, tab, title, img):
        Gtk.Box.__init__(self)
        self.set_spacing(5)

        self.win = win
        self.tab = tab

        # Preview of image
        self.icon = Gtk.Image()

        # Title
        self.label = Gtk.Label()
        self.set_title(title)

        # Close button
        button = Gtk.Button()
        button.set_relief(Gtk.ReliefStyle.NONE)
        button.add(Gtk.Image.new_from_icon_name('window-close',
            Gtk.IconSize.MENU))
        button.connect('clicked', self.on_close_button_clicked)
        self.add(self.icon)
        self.add(self.label)
        self.add(button)

        self.show_all() 
开发者ID:ImEditor,项目名称:ImEditor,代码行数:27,代码来源:tab.py

示例7: _create_refresh_button

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def _create_refresh_button(self):
        '''Create the refresh button. This it quite involved as you have
        to pack an image into the button which need to change when the
        cursor hovers over it, and change the cursor to be a
        hand over it.
        '''
        refresh_icon_filepath = os.path.join(img_dir, "refresh.png")
        refresh_icon = Gtk.Image.new_from_file(refresh_icon_filepath)
        refresh_btn = Gtk.Button()
        refresh_btn.get_style_context().add_class('refresh_btn')
        refresh_btn.set_image(refresh_icon)
        attach_cursor_events(refresh_btn)

        # These are here in case we want to change the icon on mouse over
        refresh_btn.connect('enter-notify-event', self._set_refresh_hover_icon)
        refresh_btn.connect('leave-notify-event', self._set_refresh_normal_icon)

        refresh_btn.connect('clicked', self._go_to_spinner_screen)
        return refresh_btn

    # This is linked to enter-notify-event, hence the extra arguments 
开发者ID:KanoComputing,项目名称:kano-settings,代码行数:23,代码来源:NetworkScreen.py

示例8: build_gui

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def build_gui(self):
        """
        Build the GUI interface.
        """
        self.top = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.top.set_border_width(6)

        self.entry1 = self.__add_text_view(_("Expression 1"))
        self.entry2 = self.__add_text_view(_("Expression 2"))
        self.result = self.__add_text_view(_("Result"))

        bbox = Gtk.ButtonBox()
        apply_button = Gtk.Button(label=_("Calculate"))
        apply_button.connect('clicked', self.apply_clicked)
        bbox.pack_start(apply_button, False, False, 6)
        clear_button = Gtk.Button(label=_("Clear"))
        clear_button.connect('clicked', self.clear_clicked)
        bbox.pack_start(clear_button, False, False, 6)
        self.top.pack_start(bbox, False, False, 6)

        self.top.show_all()
        self.clear_clicked(None)
        return self.top 
开发者ID:gramps-project,项目名称:addons-source,代码行数:25,代码来源:DateCalculator.py

示例9: build_gui

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def build_gui(self):
        """
        Build the GUI interface.
        """
        self.top = Gtk.Box()
        if not computer_vision_available:
            vbox = Gtk.Label(_("OpenCV-Python is not installed"))
            self.top.pack_start(vbox, False, False, 0)
            self.top.show_all()
            return self.top
        # first column:
        vbox = Gtk.Box(Gtk.Orientation.VERTICAL)
        self.top.pack_start(vbox, False, False, 0)
        self.photo = Photo()
        vbox.pack_start(self.photo, False, False, 5)
        self.detect_button = Gtk.Button(_("Detect New Faces"))
        self.detect_button.connect('button-press-event', self.detect)
        vbox.pack_start(self.detect_button, False, False, 0)
        # second column
        vbox = Gtk.Box(Gtk.Orientation.VERTICAL)
        vbox.pack_start(Gtk.Label("Image:"), False, False, 0)
        self.top.pack_start(vbox, False, False, 0)
        # show and return:
        self.top.show_all()
        return self.top 
开发者ID:gramps-project,项目名称:addons-source,代码行数:27,代码来源:FaceDetection.py

示例10: build_bkmark_ext_panel

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def build_bkmark_ext_panel(self):
        """
        Build bookmark popover extand panel.
        """
        btn_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        # add button to add active person to bookmarks
        # tooltip will be changed in "self.load_bookmarks"
        self.add_bkmark = Gtk.Button(label=_('Add active person'))
        self.add_bkmark.connect("clicked", self.add_active_to_bkmarks)
        btn_box.pack_start(self.add_bkmark, True, True, 2)
        # add buton to call bookmarks manager
        manage_bkmarks = Gtk.Button(label=_('Edit'))
        manage_bkmarks.set_tooltip_text(_('Call the bookmark editor'))
        manage_bkmarks.connect("clicked", self.edit_bookmarks)
        btn_box.pack_start(manage_bkmarks, True, True, 2)
        return btn_box 
开发者ID:gramps-project,项目名称:addons-source,代码行数:18,代码来源:graphview.py

示例11: __create_button

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def __create_button(self, text, callback=[], sensitive=False):
        """
        creates and returns a button for display
        """
        button = Gtk.Button(label=text)

        if callback is not []:
            for call_ in callback:
                button.connect("clicked", call_)

        # attach a addon widget to the button for later manipulation
        self.exif_widgets[text] = button

        if not sensitive:
            button.set_sensitive(False)

        button.show()
        return button 
开发者ID:gramps-project,项目名称:addons-source,代码行数:20,代码来源:editexifmetadata.py

示例12: insert_table

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def insert_table(self, widget):
        self.insert_window_table = Gtk.Window()
        self.insert_window_table.set_title("Insert Table")
        self.insert_window_table.set_resizable(True)
        self.insert_window_table.set_border_width(6)
        self.insert_window_table.set_default_size(300, 250)
        self.insert_window_table.set_position(Gtk.WindowPosition.CENTER)
        vbox = Gtk.VBox()
        label_n_rows = Gtk.Label("Number of Rows:")
        self.entry_n_rows = Gtk.Entry()
        label_n_columns = Gtk.Label("Number of Columns")
        self.entry_n_columns = Gtk.Entry()
        vbox.pack_start(label_n_rows, self, False, False)
        vbox.pack_start(self.entry_n_rows, self, False, False)
        vbox.pack_start(label_n_columns, self, False, False)
        vbox.pack_start(self.entry_n_columns, self, False, False)
        button = Gtk.Button("Insert Table")
        vbox.pack_end(button, self, False, False)
        self.insert_window_table.add(vbox)
        self.insert_window_table.show_all()
        button.connect("clicked", self.insert_table_cmd, self.insert_window_table) 
开发者ID:jamiemcg,项目名称:Remarkable,代码行数:23,代码来源:RemarkableWindow.py

示例13: on_menuitem_custom_activate

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def on_menuitem_custom_activate(self, widget):
        self.custom_window = Gtk.Window()
        self.custom_window.set_default_size(640, 480)
        self.custom_window.set_position(Gtk.WindowPosition.CENTER)
        self.custom_window.set_title("Custom CSS")

        self.custom_vbox = Gtk.VBox()
        self.custom_scroller = Gtk.ScrolledWindow()
        self.custom_button = Gtk.Button("Apply")
        self.custom_vbox.pack_end(self.custom_button, False, False, 0)
        self.custom_text_view = Gtk.TextView()
        self.custom_text_buffer = Gtk.TextBuffer()
        self.custom_text_buffer.set_text(self.custom_css)
        self.custom_text_view.set_buffer(self.custom_text_buffer)
        self.custom_scroller.add(self.custom_text_view)
        self.custom_vbox.pack_start(self.custom_scroller, True, True, 0)
        self.custom_window.add(self.custom_vbox)
        self.custom_window.show_all()
        self.custom_button.connect("clicked", self.apply_custom_css, self.custom_window, self.custom_text_buffer) 
开发者ID:jamiemcg,项目名称:Remarkable,代码行数:21,代码来源:RemarkableWindow.py

示例14: _populate_gtk

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def _populate_gtk(self, width):
        """Creates the Gtk.Label, the textbox and the button

        @param width: the width of the Gtk.Label object
        """
        label = Gtk.Label(label=_("Filename:"))
        label.set_line_wrap(True)
        label.set_alignment(xalign=0, yalign=0.5)
        label.set_size_request(width=width, height=-1)
        self.pack_start(label, False, True, 0)
        align = Gtk.Alignment.new(0, 0.5, 1, 0)
        align.set_padding(0, 0, 10, 0)
        self.pack_start(align, True, True, 0)
        self.textbox = Gtk.Entry()
        self.textbox.set_text(self.backend.get_parameters()['path'])
        self.textbox.connect('changed', self.on_path_modified)
        align.add(self.textbox)
        self.button = Gtk.Button()
        self.button.set_label("Edit")
        self.button.connect('clicked', self.on_button_clicked)
        self.pack_start(self.button, False, True, 0) 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:23,代码来源:path.py

示例15: _fill_bottom_box

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Button [as 别名]
def _fill_bottom_box(self, box):
        """
        Helper function to fill and box with a buttonbox, featuring
        and ok and cancel buttons.

        @param box: the Gtk.Box to fill
        """
        cancel_button = Gtk.Button()
        cancel_button.set_label("Cancel")
        cancel_button.connect('clicked', self.on_cancel)
        self.ok_button = Gtk.Button()
        self.ok_button.set_label("OK")
        self.ok_button.connect('clicked', self.on_confirm)
        align = Gtk.Alignment.new(0.5, 1, 1, 0)
        align.set_padding(0, 10, 0, 0)
        buttonbox = Gtk.ButtonBox()
        buttonbox.set_layout(Gtk.ButtonBoxStyle.EDGE)
        buttonbox.add(cancel_button)
        buttonbox.set_child_secondary(cancel_button, False)
        buttonbox.add(self.ok_button)
        align.add(buttonbox)
        box.pack_start(align, True, True, 0) 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:24,代码来源:addpanel.py


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