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


Python Gtk.Entry方法代码示例

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


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

示例1: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Entry [as 别名]
def __init__(self, **kwargs):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
        GObject.GObject.__init__(self)

        self.is_edit = kwargs.get("edit", False)
        self._account = kwargs.get("account", None)

        self._providers_store = Gtk.ListStore(str, str)

        self.logo_img = Gtk.Image()
        self.username_entry = Gtk.Entry()
        self.provider_combo = Gtk.ComboBox.new_with_model_and_entry(
            self._providers_store)
        self.token_entry = Gtk.Entry()
        self._build_widgets()
        self._fill_data() 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:18,代码来源:add.py

示例2: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Entry [as 别名]
def __init__(self, option, dbstate, uistate, track, override=False):
        Gtk.HBox.__init__(self)
        self.__option = option
        value_str = self.__option.get_value()
        (attr_inc, attr_list) = value_str.split(',',1)
        attr_list = attr_list.strip()
        self.cb_w = Gtk.CheckButton(label="")
        self.cb_w.connect('toggled', self.__value_changed)
        self.l_w = Gtk.Label(label=_('restricted to:'))
        self.l_w.set_sensitive(False)
        self.e_w = Gtk.Entry()
        self.e_w.set_text(attr_list)
        self.e_w.connect('changed', self.__value_changed)
        self.e_w.set_sensitive(False)
        self.cb_w.set_active(attr_inc == 'True')
        self.pack_start(self.cb_w, False, True, 0)
        self.pack_end(self.e_w, True, True, 0)
        self.pack_end(self.l_w, False, True, 5)
        self.set_tooltip_text(self.__option.get_help()) 
开发者ID:gramps-project,项目名称:addons-source,代码行数:21,代码来源:DenominoViso.py

示例3: __create_gui

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Entry [as 别名]
def __create_gui(self):
        """
        Create and display the GUI components of the gramplet.
        """
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        vbox.set_spacing(4)

        label = Gtk.Label(_('Enter GOV-id:'))
        label.set_halign(Gtk.Align.START)

        self.entry = Gtk.Entry()

        button_box = Gtk.ButtonBox()
        button_box.set_layout(Gtk.ButtonBoxStyle.START)

        get = Gtk.Button(label=_('Get Place'))
        get.connect("clicked", self.__get_places)
        button_box.add(get)

        vbox.pack_start(label, False, True, 0)
        vbox.pack_start(self.entry, False, True, 0)
        vbox.pack_start(button_box, False, True, 0)

        return vbox 
开发者ID:gramps-project,项目名称:addons-source,代码行数:26,代码来源:getgov.py

示例4: insert_table

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Entry [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

示例5: _populate_gtk

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

        @param width: the width of the Gtk.Label object
        """
        label = Gtk.Label(label=f"{self.description}:")
        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()
        backend_parameters = self.backend.get_parameters()[self.parameter_name]
        self.textbox.set_text(backend_parameters)
        self.textbox.connect('changed', self.on_text_modified)
        align.add(self.textbox) 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:20,代码来源:text.py

示例6: _populate_gtk

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Entry [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

示例7: smartifyComboboxEntry

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Entry [as 别名]
def smartifyComboboxEntry(combobox, list_obj, callback):
    entry = Gtk.Entry()
    # check if Clipboard contains an element of the list
    clipboard = Gtk.Clipboard()
    ifClipboardTextIsInListCallback(clipboard, list_obj, entry.set_text)
    # pressing Enter will cause the callback
    ifKeyPressedCallback(entry, "Return", callback)
    # wrap the combo-box if it's too long
    if len(list_obj) > 15:
        combobox.set_wrap_width(5)
    # populate the combo-box
    if len(list_obj) > 0:
        list_store = listStoreFromList(list_obj)
        entry.set_completion(completionFromListStore(list_store))
        combobox.set_model(list_store)
        combobox.set_active(0)
        entry.set_text(list_store[0][0])
    combobox.add(entry)
    combobox.connect('changed', setText, entry)
    # render the combo-box drop down menu
    cell = Gtk.CellRendererText()
    combobox.pack_start(cell, True)
    combobox.add_attribute(cell, 'text', 0)
    return entry 
开发者ID:getting-things-gnome,项目名称:gtg,代码行数:26,代码来源:combobox_enhanced.py

示例8: _setup_mixer_command

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Entry [as 别名]
def _setup_mixer_command(self):
        key = self._schema.get_key("mixer-command")
        row = Gtk.ListBoxRow()
        row.set_tooltip_text(key.get_description())

        hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        row.add(hbox)
        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        hbox.pack_start(vbox, True, True, 10)

        label = Gtk.Label(key.get_summary(), xalign=0)
        vbox.pack_start(label, True, True, 0)
        entry = Gtk.Entry().new()
        self._settings.bind(
            "mixer-command", entry, "text", Gio.SettingsBindFlags.DEFAULT
        )
        hbox.pack_start(entry, False, True, 10)

        self.listbox.add(row) 
开发者ID:buzz,项目名称:volctl,代码行数:21,代码来源:prefs.py

示例9: display_value

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Entry [as 别名]
def display_value(self, key, w):
		"""
		Sets value on UI element for single key. May be overridden
		by subclass to handle special values.
		"""
		if isinstance(w, Gtk.SpinButton):
			w.get_adjustment().set_value(ints(self.get_value(strip_v(key))))
		elif isinstance(w, Gtk.Entry):
			w.set_text(unicode(self.get_value(strip_v(key))))
		elif isinstance(w, Gtk.ComboBox):
			val = self.get_value(strip_v(key))
			m = w.get_model()
			for i in xrange(0, len(m)):
				if str(val) == str(m[i][0]).strip():
					w.set_active(i)
					break
			else:
				w.set_active(0)
		elif isinstance(w, Gtk.CheckButton):
			w.set_active(self.get_value(strip_v(key)))
		else:
			log.warning("display_value: %s class cannot handle widget %s, key %s", self.__class__.__name__, w, key)
			if not w is None: w.set_sensitive(False) 
开发者ID:kozec,项目名称:syncthing-gtk,代码行数:25,代码来源:editordialog.py

示例10: get_eval

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Entry [as 别名]
def get_eval(self, widget_name):
        """
        Runs eval() on the on the text entry of name 'widget_name'
        and returns the results.

        :param widget_name: Name of Gtk.Entry
        :type widget_name: str
        :return: Depends on contents of the entry text.
        """

        value = self.builder.get_object(widget_name).get_text()
        if value == "":
            value = "None"
        try:
            evald = eval(value)
            return evald
        except:
            self.info("Could not evaluate: " + value)
            return None 
开发者ID:Denvi,项目名称:FlatCAM,代码行数:21,代码来源:FlatCAMApp.py

示例11: __init__

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

        :param output_units: The default output units, 'IN' or 'MM'
        :return: LengthEntry
        """

        Gtk.Entry.__init__(self)
        self.output_units = output_units
        self.format_re = re.compile(r"^([^\s]+)(?:\s([a-zA-Z]+))?$")

        # Unit conversion table OUTPUT-INPUT
        self.scales = {
            'IN': {'IN': 1.0,
                   'MM': 1/25.4},
            'MM': {'IN': 25.4,
                   'MM': 1.0}
        }

        self.connect('activate', self.on_activate) 
开发者ID:Denvi,项目名称:FlatCAM,代码行数:22,代码来源:GUIElements.py

示例12: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Entry [as 别名]
def __init__(self, display_name, key, callback, transient_for):
        self.color_button = OomoxColorButton(
            transient_for=transient_for,
            callback=self.on_color_set
        )
        self.color_entry = Gtk.Entry(
            text=_('<none>'), width_chars=6, max_length=6
        )
        self.menu_button = OomoxLinkedDropdown(transient_for)
        self.color_entry.get_style_context().add_class(Gtk.STYLE_CLASS_MONOSPACE)
        linked_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        Gtk.StyleContext.add_class(
            linked_box.get_style_context(), "linked"
        )
        linked_box.add(self.color_entry)
        linked_box.add(self.color_button)
        linked_box.add(self.menu_button)
        super().__init__(
            display_name=display_name,
            key=key,
            callback=callback,
            value_widget=linked_box
        ) 
开发者ID:themix-project,项目名称:oomox,代码行数:25,代码来源:colors_list.py

示例13: __init__

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Entry [as 别名]
def __init__(self):
        self.builder = get_builder("report")

        self.window = self.builder.get_object("window2")

        self.number = Gtk.Entry()  # numberentry.NumberEntry()
        box = self.builder.get_object("numbox")
        box.add(self.number)
        self.number.set_activates_default(True)
        self.number.show()
        self.builder.get_object("message").set_text("")
        self.window.show_all()
        self.builder.get_object("buttonPreview").connect(
            "clicked", self.previewReport)
        self.builder.get_object("buttonExport").connect(
            "clicked", self.exportToCSV)
        self.builder.get_object("buttonPrint").connect(
            "clicked", self.printReport) 
开发者ID:Jooyeshgar,项目名称:amir,代码行数:20,代码来源:docreport.py

示例14: addNewBank

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Entry [as 别名]
def addNewBank(self, model):
        dialog = Gtk.Dialog(None, None,
                            Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
                            (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                             Gtk.STOCK_OK, Gtk.ResponseType.OK))
        label = Gtk.Label(label='Bank Name:')
        entry = Gtk.Entry()
        dialog.vbox.pack_start(label, False, False, 0)
        dialog.vbox.pack_start(entry, False, False, 0)
        dialog.show_all()
        result = dialog.run()
        bank_name = entry.get_text()
        if result == Gtk.ResponseType.OK and len(bank_name) != 0:
            iter = model.append()
            model.set(iter, 0, bank_name)
            self.add_bank(bank_name)

        dialog.destroy() 
开发者ID:Jooyeshgar,项目名称:amir,代码行数:20,代码来源:class_bankaccounts.py

示例15: demo

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import Entry [as 别名]
def demo():
    keyboard = Keyboard()

    box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

    entry = Gtk.Entry()
    entry.set_hexpand(False)
    entry.set_vexpand(False)
    entry.connect('focus-in-event', show)
    entry.connect('activate', on_activate)
    box.pack_start(entry, False, False, 5)

    window = Gtk.Window(title="Test Keyboard")
    window.connect('button-press-event', on_button_press)
    window.connect('destroy', Gtk.main_quit)
    window.add(box)

    window.set_size_request(1000, 400)
    window.show_all()

    Gtk.main() 
开发者ID:KurtJacobson,项目名称:hazzy,代码行数:23,代码来源:keyboard.py


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