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


Python Gtk.RadioButton方法代码示例

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


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

示例1: build_row

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import RadioButton [as 别名]
def build_row(self):
		"""Build the GtkRadioButton for the sidebar. This method stores it as
		'self.row', but does not pack it in the bar, and does not return it."""
		self.row = Gtk.RadioButton(relief=Gtk.ReliefStyle.NONE, \
		                        draw_indicator=False, valign=Gtk.Align.CENTER, \
		                                                tooltip_text=self.label)
		self.row.set_detailed_action_name('win.active_tool::' + self.id)
		self.label_widget = Gtk.Label(label=self.label)
		if self.get_settings().get_boolean('big-icons'):
			size = Gtk.IconSize.LARGE_TOOLBAR
		else:
			size = Gtk.IconSize.SMALL_TOOLBAR
		image = Gtk.Image().new_from_icon_name(self.icon_name, size)
		box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=8)
		box.add(image)
		box.add(self.label_widget)
		self.row.add(box)
		self.row.show_all() 
开发者ID:maoschanz,项目名称:drawing,代码行数:20,代码来源:abstract_tool.py

示例2: add_radio_option

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import RadioButton [as 别名]
def add_radio_option(self, object, label, tooltip=""):
        sensitive = object.is_available()

        group = self.buttons[0] if self.buttons else None
        button = Gtk.RadioButton(group=group)
        button.set_tooltip_markup(tooltip)
        button.set_label(label)
        button.object = object
        button.set_sensitive(sensitive)
        self.pack_start(button, False, False, 0)
        self.buttons.append(button)

        if tooltip:
            description = Gtk.Label()
            description.set_alignment(0.0, 0.5)
            description.set_markup(" " * 10 + tooltip)
            description.set_sensitive(sensitive)
            self.pack_start(description, False, False, 0) 
开发者ID:jendrikseipp,项目名称:rednotebook,代码行数:20,代码来源:customwidgets.py

示例3: _populate_gtk

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import RadioButton [as 别名]
def _populate_gtk(self, width):
        """
        Populates the widgets

        @param width: the length of the radio buttons
        """
        title_label = Gtk.Label()
        title_label.set_alignment(xalign=0, yalign=0)
        title_label.set_markup(f"<big><b>{self.title}</b></big>")
        self.pack_start(title_label, True, True, 0)
        align = Gtk.Alignment.new(0, 0, 1, 0)
        align.set_padding(0, 0, 10, 0)
        self.pack_start(align, True, True, 0)
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        align.add(vbox)
        self.all_tags_radio = Gtk.RadioButton(group=None,
                                              label=self.anybox_text)
        vbox.pack_start(self.all_tags_radio, True, True, 0)
        self.some_tags_radio = Gtk.RadioButton(group=self.all_tags_radio,
                                               label=self.somebox_text)
        self.some_tags_radio.set_size_request(width=width, height=-1)
        box = Gtk.Box()
        vbox.pack_start(box, True, True, 0)
        box.pack_start(self.some_tags_radio, False, True, 0)
        self.tags_entry = Gtk.Entry()
        box.pack_start(self.tags_entry, True, True, 0) 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:28,代码来源:import_tags.py

示例4: build_radio_btn

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import RadioButton [as 别名]
def build_radio_btn(self, label, btn_id, key, group):
		btn = Gtk.RadioButton(label=label, visible=True, group=group)
		active_id = self._settings.get_string(key)
		btn.set_active(btn_id == active_id)
		btn.connect('toggled', self.on_radio_btn_changed, key, btn_id)
		return btn 
开发者ID:maoschanz,项目名称:drawing,代码行数:8,代码来源:preferences.py

示例5: create_list

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import RadioButton [as 别名]
def create_list(self, options_list):

        message_dialog = Gtk.MessageDialog(
            None,
            0,
            Gtk.MessageType.QUESTION,
            Gtk.ButtonsType.OK,
            _("Choose version:")
            )
        message_dialog.set_default_size(360, 0)

        content_area = message_dialog.get_content_area()
        content_area.set_property('margin_top', 10)
        content_area.set_property('margin_bottom', 10)
        content_area.set_property('margin_left', 10)
        content_area.set_property('margin_right', 10)

        options_list = options_list.split(', ')

        def cb_radiobutton(radiobutton):
            self.option = radiobutton.get_label()

        box = Gtk.Box(
            orientation=Gtk.Orientation.VERTICAL,
            spacing = 10
            )

        radiobutton1 = Gtk.RadioButton(
            label = options_list[0]
            )
        radiobutton1.connect('clicked', cb_radiobutton)
        box.pack_start(radiobutton1, True, True, 0)

        for i in range(1, len(options_list)):
            radiobutton = Gtk.RadioButton(
                label = options_list[i]
                )
            radiobutton.connect('clicked', cb_radiobutton)
            radiobutton.join_group(radiobutton1)
            box.pack_start(radiobutton, True, True, 0)

        content_area.pack_start(box, True, True, 0)

        self.option = options_list[0]

        message_dialog.show_all()
        response = message_dialog.run()
        message_dialog.destroy()

        return self.option 
开发者ID:yancharkin,项目名称:games_nebula,代码行数:52,代码来源:dialogs.py

示例6: init_page

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import RadioButton [as 别名]
def init_page(self):
		""" Permits user to set WebUI settings """
		# Wall of text
		label = WrappedLabel(
			"<b>" + _("WebUI setup") + "</b>" +
			"\n\n" +
			_("Syncthing can be managed remotely using WebUI and "
			  "even if you are going to use Syncthing-GTK, WebUI needs "
			  "to be enabled, as Syncthing-GTK uses it to communicate "
			  "with the Syncthing daemon.") +
			"\n\n" +
			_("If you prefer to be able to manage Syncthing remotely, "
			  "over the internet or on your local network, select <b>listen "
			  "on all interfaces</b> and set username and password to "
			  "protect Syncthing from unauthorized access.") +
			"\n" +
			_("Otherwise, select <b>listen on localhost</b>, so only "
			  "users and programs on this computer will be able to "
			  "interact with Syncthing.") +
			"\n"
		)
		# Radiobuttons
		lbl_radios = WrappedLabel("<b>" + _("WebUI Listen Addresses") + "</b>")
		self.rb_localhost = Gtk.RadioButton(label=_("Listen on _localhost"))
		self.rb_all_intfs = Gtk.RadioButton.new_from_widget(self.rb_localhost)
		self.rb_all_intfs.set_label(_("Listen on _all interfaces"))
		for x in (self.rb_localhost, self.rb_all_intfs):
			x.set_use_underline(True)
			x.set_property('margin-left', 15)
		# Username & password input boxes
		self.tx_username = Gtk.Entry()
		self.tx_password = Gtk.Entry()
		self.lbl_username = WrappedLabel(_("_Username"))
		self.lbl_password = WrappedLabel(_("_Password"))
		self.lbl_username.set_mnemonic_widget(self.tx_username)
		self.lbl_password.set_mnemonic_widget(self.tx_password)
		self.tx_password.set_visibility(False)
		self.tx_password.props.caps_lock_warning = True
		for x in (self.lbl_username, self.lbl_password):
			x.set_use_underline(True)
			x.set_property('margin-left', 45)
			x.set_property('margin-bottom', 5)
		for x in (self.tx_username, self.tx_password):
			x.set_property('margin-bottom', 5)
		# Connect signals
		for x in (self.rb_localhost, self.rb_all_intfs):
			x.connect("toggled", self.cb_stuff_changed)
		for x in (self.tx_username, self.tx_password):
			x.connect("changed", self.cb_stuff_changed)
			x.connect("delete-text", self.cb_stuff_changed)
			x.connect("insert-text", self.cb_stuff_changed)
		# Attach everything
		self.attach(label, 0, 0, 3, 1)
		self.attach(lbl_radios, 0, 1, 3, 1)
		self.attach(self.rb_localhost, 0, 2, 2, 1)
		self.attach(self.rb_all_intfs, 0, 3, 2, 1)
		self.attach(self.lbl_username, 0, 4, 1, 1)
		self.attach(self.lbl_password, 0, 5, 1, 1)
		self.attach(self.tx_username, 1, 4, 2, 1)
		self.attach(self.tx_password, 1, 5, 2, 1) 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:62,代码来源:wizard.py

示例7: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import RadioButton [as 别名]
def __init__(self, journal, *args, **kwargs):
        AssistantPage.__init__(self, *args, **kwargs)

        self.journal = journal

        self.all_days_button = Gtk.RadioButton(label=_("Export all days"))
        self.selected_text_button = Gtk.RadioButton(group=self.all_days_button)
        self.one_day_button = Gtk.RadioButton(
            label=_("Export currently visible day"), group=self.all_days_button
        )
        self.sel_days_button = Gtk.RadioButton(
            label=_("Export days in the selected time range"),
            group=self.all_days_button,
        )

        self.pack_start(self.all_days_button, False, False, 0)
        self.pack_start(self.one_day_button, False, False, 0)
        self.pack_start(self.selected_text_button, False, False, 0)
        self.pack_start(self.sel_days_button, False, False, 0)

        label1 = Gtk.Label()
        label1.set_markup("<b>" + _("From:") + "</b>")
        label2 = Gtk.Label()
        label2.set_markup("<b>" + _("To:") + "</b>")

        show_week_numbers = self.journal.config.read("weekNumbers")
        self.calendar1 = Calendar(week_numbers=show_week_numbers)
        self.calendar2 = Calendar(week_numbers=show_week_numbers)

        vbox1 = Gtk.VBox()
        vbox2 = Gtk.VBox()
        vbox1.pack_start(label1, False, False, 0)
        vbox1.pack_start(self.calendar1, True, True, 0)
        vbox2.pack_start(label2, False, False, 0)
        vbox2.pack_start(self.calendar2, True, True, 0)

        hbox = Gtk.HBox()
        hbox.pack_start(vbox1, True, True, 0)
        hbox.pack_start(vbox2, True, True, 0)
        self.pack_start(hbox, True, True, 0)

        self.sel_days_button.connect("toggled", self._on_select_days_toggled)

        self.all_days_button.set_active(True)
        self._set_select_days(False) 
开发者ID:jendrikseipp,项目名称:rednotebook,代码行数:47,代码来源:exports.py


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