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


Python gtk.Entry方法代码示例

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


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

示例1: _on_click_text

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def _on_click_text(self, widget, event):
        # pylint: disable-msg=W0613
        """event handling text edition"""
        if event.button != 1:
            return False
        if event.type == gtk.gdk._2BUTTON_PRESS:
            self.remove (self._label)
            self._entry = gtk.Entry ()
            self._entry.set_text (self._label.get_text ())
            self._entry.show ()
            self.add (self._entry)
            sig = self._entry.connect ("focus-out-event", self._entry_to_label)
            self._entry_handler_id.append(sig)
            sig = self._entry.connect ("activate", self._on_entry_activated)
            self._entry_handler_id.append(sig)
            sig = self._entry.connect ("key-press-event",
                                         self._on_entry_keypress)
            self._entry_handler_id.append(sig)
            sig = self._entry.connect("button-press-event",
                                      self._on_entry_buttonpress)
            self._entry_handler_id.append(sig)
            self._entry.grab_focus ()
            return(True)
        return(False) 
开发者ID:OWASP,项目名称:NINJA-PingU,代码行数:26,代码来源:editablelabel.py

示例2: _entry_to_label

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def _entry_to_label (self, widget, event):
        # pylint: disable-msg=W0613
        """replace gtk.Entry by the gtk.Label"""
        if self._entry and self._entry in self.get_children():
            #disconnect signals to avoid segfault :s
            for sig in self._entry_handler_id:
                if self._entry.handler_is_connected(sig):
                    self._entry.disconnect(sig)
            self._entry_handler_id = []
            self.remove (self._entry)
            self.add (self._label)
            self._entry = None
            self.show_all ()
            self.emit('edit-done')
            return(True)
        return(False) 
开发者ID:OWASP,项目名称:NINJA-PingU,代码行数:18,代码来源:editablelabel.py

示例3: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def __init__(self):
        super(TestForm, self).__init__()

        self.set_title("Key test")
        self.set_size_request(200, 200)
        self.set_position(gtk.WIN_POS_CENTER)

        fixed = gtk.Fixed()

        entry = gtk.Entry()
        fixed.put(entry, 10, 10)

        entry.connect("key_press_event", self.on_key_press_event)

        self.connect("destroy", gtk.main_quit)
        self.add(fixed)
        self.show_all()

        # Clean the text file:
        input_file = open("/tmp/autotest-rv_input", "w")
        input_file.close() 
开发者ID:avocado-framework,项目名称:avocado-vt,代码行数:23,代码来源:key_event_form.py

示例4: key_edit_window_title

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def key_edit_window_title(self):
        window = self.get_toplevel()
        dialog = gtk.Dialog(_('Rename Window'), window,
                        gtk.DIALOG_MODAL,
                        ( gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                          gtk.STOCK_OK, gtk.RESPONSE_ACCEPT ))
        dialog.set_default_response(gtk.RESPONSE_ACCEPT)
        dialog.set_has_separator(False)
        dialog.set_resizable(False)
        dialog.set_border_width(8)
        
        label = gtk.Label(_('Enter a new title for the Terminator window...'))
        name = gtk.Entry()
        name.set_activates_default(True)
        if window.title.text != self.vte.get_window_title():
            name.set_text(self.get_toplevel().title.text)
        
        dialog.vbox.pack_start(label, False, False, 6)
        dialog.vbox.pack_start(name, False, False, 6)

        dialog.show_all()
        res = dialog.run()
        if res == gtk.RESPONSE_ACCEPT:
            if name.get_text():
                window.title.force_title(None)
                window.title.force_title(name.get_text())
            else:
                window.title.force_title(None)
        dialog.destroy()
        return

# End key events 
开发者ID:OWASP,项目名称:NINJA-PingU,代码行数:34,代码来源:terminal.py

示例5: _on_entry_keypress

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def _on_entry_keypress (self, widget, event):
        # pylint: disable-msg=W0613
        """handle keypressed in gtk.Entry"""
        key = gtk.gdk.keyval_name (event.keyval)
        if key == 'Escape':
            self._entry_to_label (None, None) 
开发者ID:OWASP,项目名称:NINJA-PingU,代码行数:8,代码来源:editablelabel.py

示例6: _on_entry_buttonpress

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def _on_entry_buttonpress (self, widget, event):
        """handle button events in gtk.Entry."""
        # Block right clicks to avoid a deadlock.
        # The correct solution here would be for _entry_to_label to trigger a
        # deferred execution handler and for that handler to check if focus is
        # in a GtkMenu. The problem being that we are unable to get a context
        # menu for the GtkEntry.
        if event.button == 3:
            return True 
开发者ID:OWASP,项目名称:NINJA-PingU,代码行数:11,代码来源:editablelabel.py

示例7: _create_command_dialog

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def _create_command_dialog(self, enabled_var = False, name_var = "", command_var = ""):
      dialog = gtk.Dialog(
                        _("New Command"),
                        None,
                        gtk.DIALOG_MODAL,
                        (
                          gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                          gtk.STOCK_OK, gtk.RESPONSE_ACCEPT
                        )
                      )
      table = gtk.Table(3, 2)

      label = gtk.Label(_("Enabled:"))
      table.attach(label, 0, 1, 0, 1)
      enabled = gtk.CheckButton()
      enabled.set_active(enabled_var)
      table.attach(enabled, 1, 2, 0, 1)

      label = gtk.Label(_("Name:"))
      table.attach(label, 0, 1, 1, 2)
      name = gtk.Entry()
      name.set_text(name_var)
      table.attach(name, 1, 2, 1, 2)
      
      label = gtk.Label(_("Command:"))
      table.attach(label, 0, 1, 2, 3)
      command = gtk.Entry()
      command.set_text(command_var)
      table.attach(command, 1, 2, 2, 3)

      dialog.vbox.pack_start(table)
      dialog.show_all()
      return (dialog,enabled,name,command) 
开发者ID:OWASP,项目名称:NINJA-PingU,代码行数:35,代码来源:custom_commands.py

示例8: inputdialog

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def inputdialog(self, text, title, default_response=""):
        # Define a little helper function
        def inputdialog_entry_activated(entry):
            dlg.response(gtk.RESPONSE_OK)

        # Create the dialog
        dlg = gtk.MessageDialog(self.window,
                                gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                                gtk.MESSAGE_QUESTION,
                                gtk.BUTTONS_OK_CANCEL,
                                title)
        dlg.set_title(title)
        dlg.format_secondary_text(text)

        # Create an entry widget
        entry = gtk.Entry()
        entry.set_text(default_response)
        entry.connect("activate", inputdialog_entry_activated)
        dlg.vbox.pack_start(entry)
        entry.show()

        # Run the dialog
        response = dlg.run()
        dlg.destroy()
        if response == gtk.RESPONSE_OK:
            return entry.get_text()
        return None 
开发者ID:avocado-framework,项目名称:avocado-vt,代码行数:29,代码来源:step_editor.py

示例9: __init__

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def __init__(self, cli, memobj, syms=None):
        vw_layout.LayoutWindow.__init__(self)
        self.cli = cli
        self.connect("key-press-event", self.keypressed)

        self.vbox = gtk.VBox()
        self.menubar = vw_menu.MenuBar()

        self.add(self.vbox)
        self.vbox.pack_start(self.menubar, expand=False)
        toolbar = self.getMainToolbar()
        if toolbar != None:
            self.vbox.pack_start(toolbar, expand=False)

        self.canvas = vw_memview.ScrolledMemoryView(memobj, syms=syms)
        self.canvas.textview.set_property("wrap_mode", gtk.WRAP_WORD)
        self.vbox.pack_start(self.canvas, expand=True)

        # If it's an EnviCli, let's over-ride the canvas right away.
        if isinstance(cli, e_cli.EnviCli):
            cli.setCanvas(self.canvas)

        entry = gtk.Entry()
        entry.connect("activate", self.cli_activate)
        entry.connect("key-press-event", self.entrykeypressed)
        self.vbox.pack_start(entry, expand=False)
        self.entry = entry

        self.history = []
        self.histidx = 0
        entry.grab_focus() 
开发者ID:joxeankoret,项目名称:nightmare,代码行数:33,代码来源:windows.py

示例10: addBg

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def addBg(self):
		"""Adds a new background to the list of backgrounds."""
		self.bgs += [gtk.Table(4, 3, False)]
		
		createLabel(self.bgs[-1], text="Corner Rounding (px)", gridX=0, gridY=0, xPadding=10)
		createEntry(self.bgs[-1], maxSize=7, width=9, text=BG_ROUNDING, gridX=1, gridY=0, xExpand=True, yExpand=False, handler=self.changeOccurred, name="rounded")
		
		createLabel(self.bgs[-1], text="Background Color", gridX=0, gridY=1, xPadding=10)
		temp = gtk.Entry(7)
		temp.set_width_chars(9)
		temp.set_name("bgColEntry")
		temp.set_text(self.defaults["bgColor"])
		temp.connect("changed", self.changeOccurred)
		temp.connect("activate", self.colorTyped)
		self.bgs[-1].attach(temp, 1, 2, 1, 2, xoptions=gtk.EXPAND)
		temp = gtk.ColorButton(gtk.gdk.color_parse(self.defaults["bgColor"]))
		temp.set_use_alpha(True)
		temp.set_name("bgCol")
		temp.connect("color-set", self.colorChange)
		self.bgs[-1].attach(temp, 2, 3, 1, 2, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND)
		
		createLabel(self.bgs[-1], text="Border Width (px)", gridX=0, gridY=2, xPadding=10)
		createEntry(self.bgs[-1], maxSize=7, width=9, text=BG_BORDER, gridX=1, gridY=2, xExpand=True, yExpand=False, handler=self.changeOccurred, name="border")
		
		createLabel(self.bgs[-1], text="Border Color", gridX=0, gridY=3, xPadding=10)
		temp = gtk.Entry(7)
		temp.set_width_chars(9)
		temp.set_name("borderColEntry")
		temp.connect("activate", self.colorTyped)
		temp.set_text(self.defaults["borderColor"])
		temp.connect("changed", self.changeOccurred)
		self.bgs[-1].attach(temp, 1, 2, 3, 4, xoptions=gtk.EXPAND)
		temp = gtk.ColorButton(gtk.gdk.color_parse(self.defaults["borderColor"]))
		temp.set_use_alpha(True)
		temp.set_name("borderCol")
		temp.connect("color-set", self.colorChange)
		self.bgs[-1].attach(temp, 2, 3, 3, 4, xoptions=gtk.EXPAND, yoptions=gtk.EXPAND)

	# Note: Only set init to True when initialising background styles.
	# This prevents unwanted calls to changeOccurred() 
开发者ID:milisarge,项目名称:malfs-milis,代码行数:42,代码来源:tintwizard.py

示例11: createEntry

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def createEntry(parent, maxSize, width, text="", gridX=0, gridY=0, sizeX=1, sizeY=1, xExpand=True, yExpand=True, handler=None, name=""):
	"""Creates a text entry widget and adds it to a parent widget."""
	temp = gtk.Entry(maxSize)
	temp.set_width_chars(width)
	temp.set_text(text)
	temp.set_name(name)
	
	if handler != None:
		temp.connect("changed", handler)
	
	parent.attach(temp, gridX, gridX+sizeX, gridY, gridY+sizeY, xoptions=gtk.EXPAND if xExpand else 0, yoptions=gtk.EXPAND if yExpand else 0)
	
	return temp 
开发者ID:milisarge,项目名称:malfs-milis,代码行数:15,代码来源:tintwizard.py

示例12: show_dialog

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def show_dialog(self, title, surname, group):
        labelSurname = gtk.Label(_("Surname"))
        entrySurname = gtk.Entry()
        if surname:
            entrySurname.set_text(surname)
        labelGroup = gtk.Label(_("Group"))
        entryGroup = gtk.Entry()
        if group:
            entryGroup.set_text(group)
        dialog = gtk.Dialog(title,
                   None,
                   gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                   (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                    gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))

        table = gtk.Table(2, 2)
        table.attach(labelSurname, 0, 1, 0, 1, xoptions=gtk.SHRINK, yoptions=gtk.EXPAND, xpadding=5, ypadding=5)
        table.attach(labelGroup, 0, 1, 1, 2, xoptions=gtk.SHRINK, yoptions=gtk.EXPAND, xpadding=5, ypadding=5)
        table.attach(entrySurname, 1, 2, 0, 1, xoptions=gtk.FILL, yoptions=gtk.EXPAND, xpadding=5, ypadding=5)
        table.attach(entryGroup, 1, 2, 1, 2, xoptions=gtk.FILL, yoptions=gtk.EXPAND, xpadding=5, ypadding=5)

        dialog.vbox.pack_start(table, fill=True, expand=True)
        dialog.show_all()

        response = dialog.run()
        if response == gtk.RESPONSE_ACCEPT:
            result = (entrySurname.get_text(), entryGroup.get_text())
        else:
            result = None
        dialog.destroy()
        return result 
开发者ID:gramps-project,项目名称:addons-source,代码行数:33,代码来源:SurnameMappingGramplet.py

示例13: get_password

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def get_password(self,parent):
		dialog = gtk.Dialog("Configure System Password",parent,gtk.DIALOG_MODAL|gtk.DIALOG_DESTROY_WITH_PARENT,(gtk.STOCK_CANCEL,gtk.RESPONSE_REJECT,gtk.STOCK_OK,gtk.RESPONSE_ACCEPT))
		self.pass1 = gtk.HBox()
                self.label1 = gtk.Label("           Passsword: ")
                self.pass1.pack_start(self.label1,False,True,0)
		self.password1 = gtk.Entry()
		self.password1.set_visibility(False)
		self.pass1.pack_start(self.password1,False,True,0)
		dialog.vbox.add(self.pass1)
		self.pass2 = gtk.HBox()
                self.label2 = gtk.Label("  Verify Password: ")
                self.pass2.pack_start(self.label2,False,True,0)
		self.password2 = gtk.Entry()
		self.password2.set_visibility(False)
		self.pass2.pack_start(self.password2,False,True,0)
		dialog.vbox.add(self.pass2)
		dialog.show_all()
		response = dialog.run()
		if response == gtk.RESPONSE_ACCEPT:
			self.a = self.password1.get_text()
			self.b = self.password2.get_text()
			dialog.destroy()
		else:
			self.a = ''
			self.b = ''
			dialog.destroy()

        # Appply Configurations to Kickstart File 
开发者ID:fcaviggia,项目名称:hardening-script-el6-kickstart,代码行数:30,代码来源:menu.py

示例14: fill_custom_fields_table

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def fill_custom_fields_table(self, add=False):
        pool_ref = self.xc_servers[self.selected_host].all['pool'].keys()[0]
        self.vboxchildtext = {}
        if "XenCenter.CustomFields" in self.xc_servers[self.selected_host].all['pool'][pool_ref]["gui_config"]:
            for ch in self.builder.get_object("vboxcustomfields").get_children():
                self.builder.get_object("vboxcustomfields").remove(ch)

            dom = xml.dom.minidom.parseString(
                self.xc_servers[self.selected_host].all['pool'][pool_ref]["gui_config"]["XenCenter.CustomFields"])
            for node in dom.getElementsByTagName("CustomFieldDefinition"):
                name = node.attributes.getNamedItem("name").value
                if name not in self.vboxchildtext:
                    vboxframe = gtk.Frame()
                    vboxframe.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
                    vboxframe.set_size_request(500, 30)
                    vboxchild = gtk.Fixed()
                    vboxchild.set_size_request(500, 30)
                    vboxevent = gtk.EventBox()
                    vboxevent.add(vboxchild)
                    vboxchildlabel = gtk.Label()
                    vboxchildlabel.set_selectable(True)
                    vboxchildlabel.set_label(name)
                    vboxchild.put(vboxchildlabel, 5, 5)
                    self.vboxchildtext[name] = gtk.Entry()
                    self.vboxchildtext[name].set_size_request(200, 20)
                    vboxchild.put(self.vboxchildtext[name], 300, 5)
                    vboxevent.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("white"))
                    self.builder.get_object("vboxcustomfields").pack_start(vboxevent, False, False, 0)
                    self.builder.get_object("vboxcustomfields").show_all()
        if add:
            self.set_custom_fields_values() 
开发者ID:OpenXenManager,项目名称:openxenmanager,代码行数:33,代码来源:window_properties.py

示例15: _create_gui_element

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import Entry [as 别名]
def _create_gui_element(self, setting):
    return gtk.Entry() 
开发者ID:khalim19,项目名称:gimp-plugin-export-layers,代码行数:4,代码来源:presenters_gtk.py


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