本文整理汇总了Python中ttk.Entry方法的典型用法代码示例。如果您正苦于以下问题:Python ttk.Entry方法的具体用法?Python ttk.Entry怎么用?Python ttk.Entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk
的用法示例。
在下文中一共展示了ttk.Entry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Entry [as 别名]
def main():
"""
Entry into script.
"""
master_version = "1.0"
logging.basicConfig(filename='/tmp/skeleton_key_v' + master_version + '.log', level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)
logger.info("Running Skeleton Key " + master_version)
root = Tk()
try:
admin_password, fwpw_status = login(root, logger)
except Exception as exception_message:
logger.error("%s: Error logging in. [%s]" % (inspect.stack()[0][3], exception_message))
sys.exit(0)
root.deiconify()
SinglePane(root, logger, admin_password, fwpw_status, master_version)
root.mainloop()
开发者ID:univ-of-utah-marriott-library-apple,项目名称:firmware_password_manager,代码行数:24,代码来源:Skeleton_Key.py
示例2: initialize
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Entry [as 别名]
def initialize(self):
"""
Set window layout.
"""
self.grid()
self.respond = ttk.Button(self, text='Get Response', command=self.get_response)
self.respond.grid(column=0, row=0, sticky='nesw', padx=3, pady=3)
self.usr_input = ttk.Entry(self, state='normal')
self.usr_input.grid(column=1, row=0, sticky='nesw', padx=3, pady=3)
self.conversation_lbl = ttk.Label(self, anchor=tk.E, text='Conversation:')
self.conversation_lbl.grid(column=0, row=1, sticky='nesw', padx=3, pady=3)
self.conversation = ScrolledText.ScrolledText(self, state='disabled')
self.conversation.grid(column=0, row=2, columnspan=2, sticky='nesw', padx=3, pady=3)
示例3: state
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Entry [as 别名]
def state(self, *args):
"""
Modify or inquire widget state.
Widget state is returned if statespec is None, otherwise it is
set according to the statespec flags and then a new state spec
is returned indicating which flags were changed. statespec is
expected to be a sequence.
"""
if args:
# change cursor depending on state to mimic Combobox behavior
states = args[0]
if 'disabled' in states or 'readonly' in states:
self.configure(cursor='arrow')
elif '!disabled' in states or '!readonly' in states:
self.configure(cursor='xterm')
return ttk.Entry.state(self, *args)
示例4: __init__
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk 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)
示例5: preferences
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk 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
#
示例6: setUp
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Entry [as 别名]
def setUp(self):
support.root_deiconify()
self.entry = ttk.Entry()
示例7: create
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Entry [as 别名]
def create(self, **kwargs):
return ttk.Entry(self.root, **kwargs)
示例8: show_window
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Entry [as 别名]
def show_window(self):
self.mainframe.grid(column=0, row=0, sticky=(N, W, E, S))
self.mainframe.columnconfigure(0, weight=1)
self.mainframe.rowconfigure(0, weight=1)
ttk.Label(self.mainframe, text=" ").grid(column=0, row=0, sticky=(N,W))
ttk.Label(self.mainframe, text='1. Pair your Light Panels ').grid(column=1, row=1, sticky=(N, W))
ttk.Checkbutton(self.mainframe, variable=self.should_use_simulator, text='Use Light Panels Simulator', command=self.toggle_aurora_simulator).grid(column=2, row=1, sticky=(N,W))
ttk.Label(self.mainframe, text='IP Address').grid(column=1, row=2, sticky=(N, W))
self.pair_entry = ttk.Entry(self.mainframe, width=35, textvariable=self.ip_addr)
self.pair_entry.grid(column=2, row=2, columnspan=2, sticky=(N, W))
self.pair_button = ttk.Button(self.mainframe, width=12, text='Pair', command=self.authenticate_with_aurora)
self.pair_button.grid(column=4, row=2, sticky=(N,W))
ttk.Label(self.mainframe, text='2. Make a color palette').grid(column=1, row=3, sticky=(N, W))
ttk.Button(self.mainframe, text="Add Color", command=self.add_color_to_palette).grid(column=1, row=4, sticky=(N, W))
ttk.Label(self.mainframe, textvariable=self.curr_palette_string, wraplength=500).grid(column=2, row=4, columnspan=2, sticky=(N, W))
ttk.Button(self.mainframe, width=12, text="Clear palette", command=self.clear_palette).grid(column=4, row=4, sticky=(N, W))
ttk.Label(self.mainframe, text='3. Build your plugin').grid(column=1, row=5, sticky=(N, W))
ttk.Label(self.mainframe, text='Plugin Location').grid(column=1, row=6, sticky=(N, W))
ttk.Entry(self.mainframe, width=35, textvariable=self.plugin_dir_path).grid(column=2, row=6, columnspan=2, sticky=(N, W))
ttk.Button(self.mainframe, width=12, text='Browse', command=self.get_plugin_dir).grid(column=4, row=6, sticky=(N, W))
ttk.Button(self.mainframe, text='Build', command=self.build_plugin).grid(column=2, row=7, columnspan=1, sticky=(N,E))
ttk.Button(self.mainframe, text='Upload & Run', command=self.play_plugin).grid(column=3, row=7, columnspan=1, sticky=N)
ttk.Button(self.mainframe, width=12, text='Stop Plugin', command=self.stop_plugin).grid(column=4, row=7, columnspan=1, sticky=(N, W))
ttk.Label(self.mainframe, text=" ").grid(column=5, row=8, sticky=(N,W))
ttk.Label(self.mainframe, text=" ").grid(column=5, row=9, sticky=(N,W))
self.pluginOptionsGUI.create_plugin_frame()
self.root.mainloop()
示例9: __init__
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Entry [as 别名]
def __init__(self, master = None, **kwargs):
ttk.Entry.__init__(self, master, "ttk::spinbox", **kwargs)
示例10: _entry
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Entry [as 别名]
def _entry(self, variable, position, kwargs = {}):
entry = ttk.Entry(self.frame1.sliders, textvariable = variable, justify = "right",
takefocus = True, **kwargs)
if position == 1:
entry.place(width = 45, relx = 0.35, x = -3, y = 26, anchor = "nw")
elif position == 2:
entry.place(width = 45, relx = 0.35, x = -3, y = 71, anchor = "nw")
elif position == 3:
entry.place(width = 45, relx = 0.85, x = -3, y = 26, anchor = "nw")
elif position == 4:
entry.place(width = 45, relx = 0.85, x = -3, y = 71, anchor = "nw")
return entry
示例11: body
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Entry [as 别名]
def body(self, master, row, columns=DEFAULT_COLUMNS, **kwargs):
"""
Place the required elements using the grid layout method.
Returns the number of rows taken by this element.
"""
label = ttk.Label(master, text=self.text)
label.grid(row=row, column=0, columnspan=1, sticky="e")
self.entry = ttk.Entry(master, textvariable=self.value)
self.entry.grid(row=row, column=1, columnspan=columns - 1, sticky="ew")
return 1
示例12: _on_motion
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Entry [as 别名]
def _on_motion(self, event):
"""Set widget state depending on mouse position to mimic Combobox behavior."""
x, y = event.x, event.y
if 'disabled' not in self.state():
if self.identify(x, y) == self._downarrow_name:
self.state(['active'])
ttk.Entry.configure(self, cursor='arrow')
else:
self.state(['!active'])
ttk.Entry.configure(self, cursor=self._cursor)
示例13: destroy
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Entry [as 别名]
def destroy(self):
try:
self.after_cancel(self._determine_downarrow_name_after_id)
except ValueError:
# nothing to cancel
pass
ttk.Entry.destroy(self)
示例14: cget
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Entry [as 别名]
def cget(self, key):
"""Return the resource value for a KEY given as string."""
if key in self.entry_kw:
return ttk.Entry.cget(self, key)
elif key == 'calendar_cursor':
return self._calendar.cget('cursor')
else:
return self._calendar.cget(key)
示例15: configure
# 需要导入模块: import ttk [as 别名]
# 或者: from ttk import Entry [as 别名]
def configure(self, cnf={}, **kw):
"""
Configure resources of a widget.
The values for resources are specified as keyword
arguments. To get an overview about
the allowed keyword arguments call the method :meth:`~DateEntry.keys`.
"""
if not isinstance(cnf, dict):
raise TypeError("Expected a dictionary or keyword arguments.")
kwargs = cnf.copy()
kwargs.update(kw)
entry_kw = {}
keys = list(kwargs.keys())
for key in keys:
if key in self.entry_kw:
entry_kw[key] = kwargs.pop(key)
font = kwargs.get('font', None)
if font is not None:
entry_kw['font'] = font
self._cursor = str(entry_kw.get('cursor', self._cursor))
if entry_kw.get('state') == 'readonly' and self._cursor == 'xterm' and 'cursor' not in entry_kw:
entry_kw['cursor'] = 'arrow'
self._cursor = 'arrow'
ttk.Entry.configure(self, entry_kw)
kwargs['cursor'] = kwargs.pop('calendar_cursor', None)
self._calendar.configure(kwargs)
if 'date_pattern' in kwargs or 'locale' in kwargs:
self._set_text(self.format_date(self._date))