本文整理汇总了Python中Tkinter.Entry方法的典型用法代码示例。如果您正苦于以下问题:Python Tkinter.Entry方法的具体用法?Python Tkinter.Entry怎么用?Python Tkinter.Entry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tkinter
的用法示例。
在下文中一共展示了Tkinter.Entry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def __init__(self, main_window, msg='Please enter a node:'):
tk.Toplevel.__init__(self)
self.main_window = main_window
self.title('Node Entry')
self.geometry('170x160')
self.rowconfigure(3, weight=1)
tk.Label(self, text=msg).grid(row=0, column=0, columnspan=2,
sticky='NESW',padx=5,pady=5)
self.posibilities = [d['dataG_id'] for n,d in
main_window.canvas.dispG.nodes_iter(data=True)]
self.entry = AutocompleteEntry(self.posibilities, self)
self.entry.bind('<Return>', lambda e: self.destroy(), add='+')
self.entry.grid(row=1, column=0, columnspan=2, sticky='NESW',padx=5,pady=5)
tk.Button(self, text='Ok', command=self.destroy).grid(
row=3, column=0, sticky='ESW',padx=5,pady=5)
tk.Button(self, text='Cancel', command=self.cancel).grid(
row=3, column=1, sticky='ESW',padx=5,pady=5)
# Make modal
self.winfo_toplevel().wait_window(self)
示例2: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def __init__(self, master=None, widget=None, **kw):
"""Constructs a Ttk Entry widget with the parent master.
STANDARD OPTIONS
class, cursor, style, takefocus, xscrollcommand
WIDGET-SPECIFIC OPTIONS
exportselection, invalidcommand, justify, show, state,
textvariable, validate, validatecommand, width
VALIDATION MODES
none, key, focus, focusin, focusout, all
"""
Widget.__init__(self, master, widget or "ttk::entry", kw)
示例3: show_mnemonic_gui
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def show_mnemonic_gui(mnemonic_sentence):
"""may be called *after* main() to display the successful result iff the GUI is in use
:param mnemonic_sentence: the mnemonic sentence that was found
:type mnemonic_sentence: unicode
:rtype: None
"""
assert tk_root
global pause_at_exit
padding = 6
tk.Label(text="WARNING: seed information is sensitive, carefully protect it and do not share", fg="red") \
.pack(padx=padding, pady=padding)
tk.Label(text="Seed found:").pack(side=tk.LEFT, padx=padding, pady=padding)
entry = tk.Entry(width=80, readonlybackground="white")
entry.insert(0, mnemonic_sentence)
entry.config(state="readonly")
entry.select_range(0, tk.END)
entry.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=padding, pady=padding)
tk_root.deiconify()
tk_root.lift()
entry.focus_set()
tk_root.mainloop() # blocks until the user closes the window
pause_at_exit = False
示例4: build_bm_gui_table
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def build_bm_gui_table(self,*event):
for element in self.beam_gui_list:
element.destroy()
del self.beam_gui_list[:]
for i,bm in enumerate(self.beam_inputs):
a = tk.Entry(self.bm_info_tab,textvariable=bm[0], width=8, state=tk.DISABLED)
a.grid(row=i+2,column=1, pady=4)
b = tk.Entry(self.bm_info_tab,textvariable=bm[1], width=8)
b.grid(row=i+2,column=2)
c = tk.Entry(self.bm_info_tab,textvariable=bm[2], width=8)
c.grid(row=i+2,column=3)
d = tk.Entry(self.bm_info_tab,textvariable=bm[3], width=8)
d.grid(row=i+2,column=4)
self.beam_gui_list.extend([a,b,c,d])
示例5: _make_file_select
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def _make_file_select(self, parent, rowidx, label):
# Create string variable.
tkstr = tk.StringVar()
# Create callback event handler.
cmd = lambda: self._file_select(tkstr)
# Create the Label, Entry, and Button objects.
label = tk.Label(parent, text=label)
entry = tk.Entry(parent, textvariable=tkstr)
button = tk.Button(parent, text='...', command=cmd)
label.grid(row=rowidx, column=0, sticky='W')
entry.grid(row=rowidx, column=1)
button.grid(row=rowidx, column=2)
return tkstr
# Set status text, and optionally update cursor.
示例6: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def __init__(self, master=None, **kw):
if platform == 'darwin':
kw['highlightbackground'] = kw.pop('highlightbackground', PAGEBG)
tk.Entry.__init__(self, master, **kw)
else:
ttk.Entry.__init__(self, master, **kw)
示例7: initialize
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def initialize(self):
L = Tkinter.Label(master=self,text="Targeted IP:")
L.pack()
self.E = Tkinter.Entry(master=self,width=50)
self.E.pack()
B= Tkinter.Button(master=self,text='Check IP',command=self.checkIp)
B.pack()
self.grid()
示例8: preferences
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def preferences(self, event=None):
preferenceTop = tkinter.Toplevel()
preferenceTop.focus_set()
notebook = ttk.Notebook(preferenceTop)
frame1 = ttk.Frame(notebook)
notebook.add(frame1, text='general')
frame2 = ttk.Frame(notebook)
notebook.add(frame2, text='shortcuts')
c = ttk.Checkbutton(frame1, text="Match whole word when broadcasting annotation", variable=self._whole_word)
c.pack()
shortcuts_vars = []
shortcuts_gui = []
cur_row = 0
j = -1
frame_list = []
frame_list.append(ttk.LabelFrame(frame2, text="common shortcuts"))
frame_list[-1].pack(fill="both", expand="yes")
for i, shortcut in enumerate(self.shortcuts):
j += 1
key, cmd, bindings = shortcut
name, command = cmd
shortcuts_vars.append(tkinter.StringVar(frame_list[-1], value=key))
tkinter.Label(frame_list[-1], text=name).grid(row=cur_row, column=0, sticky=tkinter.W)
entry = tkinter.Entry(frame_list[-1], textvariable=shortcuts_vars[j])
entry.grid(row=cur_row, column=1)
cur_row += 1
notebook.pack()
#
# ? menu methods
#
示例9: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def __init__(self, parent, msg, title, hidden, text_variable):
tk.Frame.__init__(self, parent)
self.parent = parent
self.parent.protocol("WM_DELETE_WINDOW", self.cancel_function)
self.parent.bind('<Return>', self.ok_function)
self.parent.title(title)
self.input_text = text_variable
if Settings.PopupLocation:
self.parent.geometry("+{}+{}".format(
Settings.PopupLocation.x,
Settings.PopupLocation.y))
self.msg = tk.Message(self.parent, text=msg)
self.msg.grid(row=0, sticky="NSEW", padx=10, pady=10)
self.input_entry = tk.Entry(self.parent, width=50, textvariable=self.input_text)
if hidden:
self.input_entry.config(show="*")
self.input_entry.grid(row=1, sticky="EW", padx=10)
self.button_frame = tk.Frame(self.parent)
self.button_frame.grid(row=2, sticky="E")
self.cancel = tk.Button(
self.button_frame,
text="Cancel",
command=self.cancel_function,
width=10)
self.cancel.grid(row=0, column=0, padx=10, pady=10)
self.ok_button = tk.Button(
self.button_frame,
text="Ok",
command=self.ok_function,
width=10)
self.ok_button.grid(row=0, column=1, padx=10, pady=10)
self.input_entry.focus_set()
示例10: create
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def create(self, **kwargs):
return tkinter.Entry(self.root, **kwargs)
示例11: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def __init__(self, parent):
tk.LabelFrame.__init__(self, parent, text="Plot Custom Range")
self.parent = parent
self.lab = tk.Label(self, text='Custom range:')
self.rangeVar = tk.StringVar(value='chrX:YYYYYY-ZZZZZZ')
self.entry = tk.Entry(self, textvariable=self.rangeVar, width=25)
self.setter = tk.Button(self, text="Plot Custom", command=self.do_plot)
self.lab.grid(row=0, column=0, sticky=tk.NSEW)
self.entry.grid(row=0, column=1, sticky=tk.NSEW)
self.setter.grid(row=0, column=2, sticky=tk.NSEW)
示例12: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def __init__(self, master, *scripts, **opts):
# build gui:
Tkinter.Frame.__init__(self, master, **opts)
master.title("Py-Span-Task")
self.scripts = list(scripts)
self.opts = {}
self.display_var = Tkinter.StringVar("")
width = master.winfo_screenwidth()
self.display = Tkinter.Message(self, justify=LEFT, textvar=self.display_var,
font=(fontname, fontsize),
width=width-(width/10), bg="white")
self.display.pack(fill=BOTH, expand=1)
self.entry_var = Tkinter.StringVar("")
self.entry = Tkinter.Entry(self, font=(fontname, fontsize),
state="disabled",
textvar=self.entry_var)
self.entry.pack(fill=X)
self.entry.bind('<Return>', lambda e:self.key_pressed('<Return>'))
self.bind('<space>', lambda e:self.key_pressed('<space>'))
# Sometimes lexical closures suck:
def event_handler_creator(frame, key):
return lambda e:frame.key_pressed(key)
for v in responses.values():
self.bind(v, event_handler_creator(self, v))
self.focus_set()
self.key_pressed(None)
示例13: configPasswordEntry
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def configPasswordEntry(self):
"""Gui Password Entry Configuration"""
self.startButton.config(text=_("Open Sessions"), state=tkinter.NORMAL)
self.chooseNsfButton.config(text=_("Select Directory of SOURCE nsf files"),
state=tkinter.DISABLED)
self.chooseDestButton.config(text=_("Select Directory of DESTINATION files"),
state=tkinter.DISABLED)
self.entryPassword.config(state=tkinter.NORMAL)
self.formatTypeEML.config(state=tkinter.DISABLED)
self.formatTypeMBOX.config(state=tkinter.DISABLED)
self.formatTypePST.config(state=tkinter.DISABLED)
self.optionsButton.config(state=tkinter.DISABLED)
示例14: configDirectoryEntry
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def configDirectoryEntry(self, SetDefaultPath=True):
"""Gui Directory Entry Configuration"""
self.startButton.config(text=_("Convert"), state=tkinter.NORMAL)
self.entryPassword.config(state=tkinter.DISABLED)
self.formatTypeEML.config(state=tkinter.NORMAL)
self.formatTypeMBOX.config(state=tkinter.NORMAL)
self.formatTypePST.config(state=tkinter.NORMAL)
self.optionsButton.config(state=tkinter.NORMAL)
if SetDefaultPath:
op = None
try:
op = os.path.join(os.path.dirname(self.Lotus.URLDatabase.FilePath), 'archive')
except (pywintypes.com_error, OSError): # pylint: disable=E1101
try:
op = os.path.join(os.path.expanduser('~'), 'archive')
except OSError:
op = None
finally:
if os.path.exists(op):
self.nsfPath = op
else:
self.nsfPath = '.'
sp = os.path.join(os.path.expanduser('~'), 'Documents')
if os.path.exists(sp):
self.destPath = sp
else:
self.destPath = '.'
self.chooseNsfButton.config(text=_("Source directory is : %s") % self.nsfPath)
self.chooseNsfButton.config(state=tkinter.NORMAL)
self.chooseDestButton.config(text=_("Destination directory is %s") % self.destPath)
self.chooseDestButton.config(state=tkinter.NORMAL)
示例15: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import Entry [as 别名]
def __init__(self, master):
self.master = master
self.frame = Tkinter.Frame(self.master)
###Setup GUI buttons and labels for entering power factor###
self.buttonPwrFact = Tkinter.Button(self.frame,height=1, width=20,text=u"Set power factor",command=self.serPwrFactorbutton)
self.buttonPwrFact.grid(column=0,row=0)
self.PwrFactVariable = Tkinter.StringVar()
self.entry = Tkinter.Entry(self.frame,textvariable=self.PwrFactVariable)
self.entry.grid(column=0,row=1,sticky='EW')
self.frame.pack()