本文整理汇总了Python中gtk.Entry类的典型用法代码示例。如果您正苦于以下问题:Python Entry类的具体用法?Python Entry怎么用?Python Entry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Entry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self,value=None):
super(MDSplusRoutineWidget,self).__init__(rows=4,columns=2,homogeneous=False)
self.image=Entry()
self.routine=Entry()
self.args=list()
self.argTable=Table(rows=8,columns=2,homogeneous=False)
for i in range(8):
self.args.append(Entry())
self.argTable.attach(Label("Arg %d: " % (i+1,)),0,1,i,i+1,0,0)
self.argTable.attach(self.args[i],1,2,i,i+1,EXPAND|FILL,0)
self.scrolledWindow=ScrolledWindow()
self.scrolledWindow.add_with_viewport(self.argTable)
self.scrolledWindow.set_policy(POLICY_NEVER,POLICY_ALWAYS)
adj=self.scrolledWindow.get_vadjustment()
adj.connect("changed",adj_changed)
self.timeout=Entry()
self.attach(Label("Library:"),0,1,0,1,0,0)
self.attach(self.image,1,2,0,1,EXPAND|FILL,0)
self.attach(Label("Routine:"),0,1,1,2,0,0)
self.attach(self.routine,1,2,1,2,EXPAND|FILL,0)
self.attach(self.scrolledWindow,0,2,2,3)
self.attach(Label("Timeout:"),0,1,3,4,0,0)
self.attach(self.timeout,1,2,3,4,EXPAND|FILL,0)
self.set_row_spacings(5)
self.value=value
示例2: search_dialog
class search_dialog(Dialog):
def __init__(self, parent, icon):
Dialog.__init__(self, _("Search for.."), parent,
DIALOG_MODAL | DIALOG_DESTROY_WITH_PARENT,
(STOCK_OK, RESPONSE_ACCEPT,
STOCK_CANCEL, RESPONSE_REJECT))
self.set_icon(pixbuf_new_from_file(icon))
self._setup_layout()
def _setup_layout(self):
self.label = Label(_("Insert keywords:"))
self.entry = Entry()
self.entry.connect("activate", self._entry_response)
self.vbox.pack_start(self.label, False, False, 0)
self.vbox.pack_start(self.entry, False, False, 0)
self.vbox.show_all()
def _entry_response(self, widget, data=None):
self.response(RESPONSE_ACCEPT)
示例3: password_dialog
class password_dialog(Dialog):
def __init__(self, parent, icon):
Dialog.__init__(self, "GtkPacman Login", parent,
DIALOG_MODAL | DIALOG_DESTROY_WITH_PARENT,
(STOCK_OK, RESPONSE_ACCEPT, STOCK_CANCEL, RESPONSE_REJECT))
self.set_icon(pixbuf_new_from_file(icon))
self._setup_layout()
def _setup_layout(self):
self.password_entry = Entry()
self.password_entry.set_visibility(False)
self.password_entry.set_invisible_char('*')
info_label = Label(' Enter root password ')
self.hbox = HBox()
self.vbox.pack_start(info_label)
self.vbox.pack_start(self.password_entry)
self.vbox.pack_start(self.hbox)
self.show_all()
def show_warning(self):
image = Image()
image.set_from_stock(STOCK_STOP, ICON_SIZE_BUTTON)
warning_label = Label(' Invalid Password! ')
self.hbox.pack_start(image, False, False, 10)
self.hbox.pack_start(warning_label, False, False, 0)
self.show_all()
示例4: ItemEntry_orig
class ItemEntry_orig(HBox):
def __init__(self, item, name='ItemEntry'):
HBox.__init__(self)
self.set_name(name)
self._key_, self._val_ = item
self.label = Label(self._key_)
self.entry = Entry()
self.entry.set_text(self._val_)
self.pack_start(self.label,0,0,0)
self.pack_end(self.entry,0,0,0)
map(lambda x: x.show(), [self.label, self.entry])
self.show()
示例5: __init__
def __init__(self,value=None):
super(MDSplusWindowWidget,self).__init__(rows=3,columns=2,homogeneous=False)
self.startIdx=Entry()
self.endIdx=Entry()
self.timeAt0=Entry()
self.attach(Label("StartIdx: "),0,1,0,1,0,0)
self.attach(self.startIdx,1,2,0,1,EXPAND|FILL,0)
self.attach(Label("EndIdx: "),0,1,1,2,0,0)
self.attach(self.endIdx,1,2,1,2,EXPAND|FILL,0)
self.attach(Label("TimeAt0:"),0,1,2,3,0,0)
self.attach(self.timeAt0,1,2,2,3,EXPAND|FILL,0)
self.set_row_spacings(5)
self.value=value
示例6: __init__
def __init__(self,value=None):
super(MDSplusRangeWidget,self).__init__(rows=3,columns=2,homogeneous=False)
self.begin=Entry()
self.ending=Entry()
self.delta=Entry()
self.attach(Label("Begin: "),0,1,0,1,0,0)
self.attach(self.begin,1,2,0,1,EXPAND|FILL,0)
self.attach(Label("Ending: "),0,1,1,2,0,0)
self.attach(self.ending,1,2,1,2,EXPAND|FILL,0)
self.attach(Label("Delta:"),0,1,2,3,0,0)
self.attach(self.delta,1,2,2,3,EXPAND|FILL,0)
self.set_row_spacings(5)
self.value=value
示例7: input_entry_dialog
def input_entry_dialog(msg, default_answer="", parent=None):
dia = Dialog(
msg, parent, gtk.DIALOG_MODAL |gtk.DIALOG_DESTROY_WITH_PARENT,
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
gtk.STOCK_OK, RESPONSE_OK) )
dia.vbox.pack_start(Label(msg))
da_entry = Entry()
da_entry.set_text(default_answer)
dia.vbox.pack_end( da_entry )
dia.show_all()
result = dia.run()
datext = da_entry.get_text()
dia.destroy()
return datext if result == RESPONSE_OK else None
示例8: MDSplusSequentialWidget
class MDSplusSequentialWidget(Table):
def __init__(self,value=None):
super(MDSplusSequentialWidget,self).__init__(rows=4,columns=2,homogeneous=False)
self.ident=Entry()
self.phase=Entry()
self.sequence=Entry()
self.event=Entry()
self.attach(Label("Server: "),0,1,0,1,0,0)
self.attach(self.ident,1,2,0,1,EXPAND|FILL,0)
self.attach(Label("Phase: "),0,1,1,2,0,0)
self.attach(self.phase,1,2,1,2,EXPAND|FILL,0)
self.attach(Label("Sequence:"),0,1,2,3,0,0)
self.attach(self.sequence,1,2,2,3,EXPAND|FILL,0)
self.attach(Label("Event: "),0,1,3,4,0,0)
self.attach(self.event,1,2,3,4,EXPAND|FILL,0)
self.set_row_spacings(5)
self.value=value
def getValue(self):
ans=Dispatch(dispatch_type=2)
ans.ident=self.ident.get_text()
try:
ans.ident=Data.compile(ans.ident)
except Exception,e:
pass
ans.phase=self.phase.get_text()
try:
ans.phase=Data.compile(ans.phase)
except Exception,e:
pass
示例9: __init__
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()
示例10: _FieldEntry
class _FieldEntry(HBox):
def __init__(self, name, default=None):
HBox.__init__(self)
self.set_name(name)
self.label = Label(name)
self.entry = Entry()
self.pack_start(self.label, True, True, 0)
self.add(self.entry)
self.label.show()
self.entry.show()
if default:
self.set(default)
self.show()
def set(self, value):
self.entry.set_text(value)
示例11: __init__
def __init__(self,value=None):
super(MDSplusSequentialWidget,self).__init__(rows=4,columns=2,homogeneous=False)
self.ident=Entry()
self.phase=Entry()
self.sequence=Entry()
self.event=Entry()
self.attach(Label("Server: "),0,1,0,1,0,0)
self.attach(self.ident,1,2,0,1,EXPAND|FILL,0)
self.attach(Label("Phase: "),0,1,1,2,0,0)
self.attach(self.phase,1,2,1,2,EXPAND|FILL,0)
self.attach(Label("Sequence:"),0,1,2,3,0,0)
self.attach(self.sequence,1,2,2,3,EXPAND|FILL,0)
self.attach(Label("Event: "),0,1,3,4,0,0)
self.attach(self.event,1,2,3,4,EXPAND|FILL,0)
self.set_row_spacings(5)
self.value=value
示例12: change_user_dialog
class change_user_dialog(Dialog):
def __init__(self, parent, icon):
Dialog.__init__(self, _("Confirm makepkg as root"),
parent, DIALOG_MODAL | DIALOG_DESTROY_WITH_PARENT,
(STOCK_OK, RESPONSE_ACCEPT,
STOCK_CANCEL, RESPONSE_REJECT))
self.add_button(_("Run as root"), 1000)
lab = Label(_("Running makepkg as root is a bad idea.\nSelect an alternate user or confirm that you want to run it as root"))
uname_frame = Frame(_("Username:"))
pwd_frame = Frame(_("Password"))
self.uname_entry = Entry()
uname_frame.add(self.uname_entry)
self.vbox.pack_start(lab)
self.vbox.pack_start(uname_frame)
self.vbox.show_all()
def run(self):
res = Dialog.run(self)
if res == 1000:
return "root"
elif res == RESPONSE_ACCEPT:
uname = self.uname_entry.get_text()
return uname
else:
self.destroy()
return "reject"
示例13: __init__
def __init__(self, parent, icon):
Dialog.__init__(
self,
_("Confirm makepkg as root"),
parent,
DIALOG_MODAL | DIALOG_DESTROY_WITH_PARENT,
(STOCK_OK, RESPONSE_ACCEPT, STOCK_CANCEL, RESPONSE_REJECT),
)
self.add_button(_("Run as root"), 1000)
lab = Label(
_(
"Running makepkg as root is a bad idea.\nSelect an alternate user or confirm that you want to run it as root"
)
)
uname_frame = Frame(_("Username:"))
pwd_frame = Frame(_("Password"))
self.uname_entry = Entry()
uname_frame.add(self.uname_entry)
self.vbox.pack_start(lab)
self.vbox.pack_start(uname_frame)
self.vbox.show_all()
示例14: on_add_button_clicked
def on_add_button_clicked(self, *args):
# Ask the user for a new trustor's name.
md = MessageDialog(parent = self.top_window,
type = MESSAGE_QUESTION,
buttons = BUTTONS_OK_CANCEL,
message_format = "What's the new trustor's name?")
vbox = md.get_child()
name_entry = Entry()
vbox.pack_end(name_entry)
vbox.show_all()
r = md.run()
new_trustor_name = name_entry.get_text()
md.destroy() # destroys embedded widgets too
# Save the new trustor.
if r == RESPONSE_OK and new_trustor_name != '':
self.current_name = new_trustor_name
self.trust_module.add_trustor_by_name(new_trustor_name)
transaction.get().commit()
self.refresh_trustor_list()
示例15: __init__
def __init__(self):
Table.__init__(self, 1, 5)
self.entry1 = Entry()
self.entry2 = Entry()
self.button = Button("Search")
self.attach(self.entry1, 0, 1, 0, 1)
self.attach(self.entry2, 1, 2, 0, 1)
self.attach(self.button, 2, 3, 0, 1)
self.entry1.set_width_chars(12)
self.entry2.set_width_chars(12)
self.entry1.set_text("59.666042")
self.entry2.set_text("16.481794")
self.button.connect('clicked', self.clicked)