本文整理汇总了Python中tkinter.E属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.E属性的具体用法?Python tkinter.E怎么用?Python tkinter.E使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.E属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def build(self, property_dict):
for c in self.interior.winfo_children():
c.destroy()
# Filter property dict
property_dict = {k: v for k, v in property_dict.items()
if self._key_filter_function(k)}
# Prettify key/value pairs for display
property_dict = {self._make_key_pretty(k): self._make_value_pretty(v)
for k, v in property_dict.items()}
# Sort by key and filter
dict_values = sorted(property_dict.items(), key=lambda x: x[0])
for n,(k,v) in enumerate(dict_values):
tk.Label(self.interior, text=k, borderwidth=1, relief=tk.SOLID,
wraplength=75, anchor=tk.E, justify=tk.RIGHT).grid(
row=n, column=0, sticky='nesw', padx=1, pady=1, ipadx=1)
tk.Label(self.interior, text=v, borderwidth=1,
wraplength=125, anchor=tk.W, justify=tk.LEFT).grid(
row=n, column=1, sticky='nesw', padx=1, pady=1, ipadx=1)
示例2: create_layout
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def create_layout(self):
pad = dict(padx=PAD, pady=PAD)
padWE = dict(sticky=(tk.W, tk.E), **pad)
self.findLabel.grid(row=0, column=0, sticky=tk.W, **pad)
self.findEntry.grid(row=0, column=1, **padWE)
self.replaceLabel.grid(row=1, column=0, sticky=tk.W, **pad)
self.replaceEntry.grid(row=1, column=1, **padWE)
self.caseSensitiveCheckbutton.grid(row=2, column=0, columnspan=2,
**padWE)
self.wholeWordsCheckbutton.grid(row=3, column=0, columnspan=2,
**padWE)
self.findButton.grid(row=0, column=2, **padWE)
self.replaceButton.grid(row=1, column=2, **padWE)
self.closeButton.grid(row=2, column=2, **padWE)
self.extendButton.grid(row=3, column=2, **padWE)
self.grid_columnconfigure(1, weight=1)
self.minsize(180, 90)
self.maxsize(600, 150)
self.geometry("+{}+{}".format(self.master.winfo_rootx() + 200,
self.master.winfo_rooty() - 30))
示例3: layout_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def layout_widgets(self):
pad = dict(padx=PAD, pady=PAD)
padWE = dict(sticky=(tk.W, tk.E), **pad)
self.sourceLabel.grid(row=0, column=0, sticky=tk.W, **pad)
self.sourceEntry.grid(row=0, column=1, columnspan=3, **padWE)
self.sourceButton.grid(row=0, column=4, **pad)
self.targetLabel.grid(row=1, column=0, sticky=tk.W, **pad)
self.targetEntry.grid(row=1, column=1, columnspan=3, **padWE)
self.targetButton.grid(row=1, column=4, **pad)
self.dimensionLabel.grid(row=2, column=0, sticky=tk.W, **pad)
self.dimensionCombobox.grid(row=2, column=1, **padWE)
self.helpButton.grid(row=2, column=3, **pad)
self.scaleButton.grid(row=2, column=4, **pad)
self.aboutButton.grid(row=3, column=3, **pad)
self.quitButton.grid(row=3, column=4, **pad)
self.statusLabel.grid(row=3, column=0, columnspan=3, **padWE)
self.grid()
示例4: create_statusbar
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def create_statusbar(self):
statusBar = ttk.Frame(self.master)
statusLabel = ttk.Label(statusBar, textvariable=self.statusText)
statusLabel.grid(column=0, row=0, sticky=(tk.W, tk.E))
self.modifiedLabel = ttk.Label(statusBar, relief=tk.SUNKEN,
anchor=tk.CENTER)
self.modifiedLabel.grid(column=1, row=0, pady=2, padx=1)
TkUtil.Tooltip.Tooltip(self.modifiedLabel,
text="MOD if the text has unsaved changes")
self.positionLabel = ttk.Label(statusBar, relief=tk.SUNKEN,
anchor=tk.CENTER)
self.positionLabel.grid(column=2, row=0, sticky=(tk.W, tk.E),
pady=2, padx=1)
TkUtil.Tooltip.Tooltip(self.positionLabel,
text="Current line and column position")
ttk.Sizegrip(statusBar).grid(row=0, column=4, sticky=(tk.S, tk.E))
statusBar.columnconfigure(0, weight=1)
statusBar.grid(row=2, column=0, columnspan=3, sticky=(tk.W, tk.E))
self.set_status_text("Start typing to create a new document or "
"click File→Open")
示例5: create_window
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def create_window(self):
self.root.grid_rowconfigure(1,weight=1)
self.root.grid_columnconfigure(0,weight=1)
self.img_label = tk.Label(self.root)
self.img_label.configure(image=self.c_img)
self.hist_label = tk.Label(self.root)
self.hist_label.grid(row=0,column=0)
#self.img_label.pack(fill=tk.BOTH)
self.img_label.grid(row=1,column=0,
rowspan=len(self.camera.settings_dict)+2, sticky=tk.N+tk.E+tk.S+tk.W)
self.create_inputs()
self.create_infos()
self.img_label.bind('<Motion>', self.update_reticle)
self.img_label.bind('<4>', self.zoom_in)
self.img_label.bind('<5>', self.zoom_out)
self.root.bind('<MouseWheel>', self.zoom)
self.img_label.bind('<1>', self.start_move)
self.img_label.bind('<B1-Motion>', self.move)
示例6: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def __init__(self, parent, label='', input_class=ttk.Entry,
input_var=None, input_args=None, label_args=None,
**kwargs):
super().__init__(parent, **kwargs)
input_args = input_args or {}
label_args = label_args or {}
self.variable = input_var
if input_class in (ttk.Checkbutton, ttk.Button, ttk.Radiobutton):
input_args["text"] = label
input_args["variable"] = input_var
else:
self.label = ttk.Label(self, text=label, **label_args)
self.label.grid(row=0, column=0, sticky=(tk.W + tk.E))
input_args["textvariable"] = input_var
self.input = input_class(self, **input_args)
self.input.grid(row=1, column=0, sticky=(tk.W + tk.E))
self.columnconfigure(0, weight=1)
self.error = getattr(self.input, 'error', tk.StringVar())
self.error_label = ttk.Label(self, textvariable=self.error)
self.error_label.grid(row=2, column=0, sticky=(tk.W + tk.E))
示例7: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def __init__(self, parent, label='', input_class=ttk.Entry,
input_var=None, input_args=None, label_args=None,
**kwargs):
super().__init__(parent, **kwargs)
input_args = input_args or {}
label_args = label_args or {}
self.variable = input_var
if input_class in (ttk.Checkbutton, ttk.Button, ttk.Radiobutton):
input_args["text"] = label
input_args["variable"] = input_var
else:
self.label = ttk.Label(self, text=label, **label_args)
self.label.grid(row=0, column=0, sticky=(tk.W + tk.E))
input_args["textvariable"] = input_var
self.input = input_class(self, **input_args)
self.input.grid(row=1, column=0, sticky=(tk.W + tk.E))
self.columnconfigure(0, weight=1)
示例8: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def __init__(self, parent, *args, **kwargs):
super().__init__(parent, *args, **kwargs)
self.name = tk.StringVar()
self.hello_string = tk.StringVar()
self.hello_string.set("Hello World")
name_label = ttk.Label(self, text="Name:")
name_entry = ttk.Entry(self, textvariable=self.name)
ch_button = ttk.Button(self, text="Change", command=self.on_change)
hello_label = ttk.Label(self, textvariable=self.hello_string,
font=("TkDefaultFont", 64), wraplength=600)
# Layout form
name_label.grid(row=0, column=0, sticky=tk.W)
name_entry.grid(row=0, column=1, sticky=(tk.W + tk.E))
ch_button.grid(row=0, column=2, sticky=tk.E)
hello_label.grid(row=1, column=0, columnspan=3)
self.columnconfigure(1, weight=1)
示例9: configure_canvas
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def configure_canvas(self):
self.figure = Figure(dpi=100)
self.canvas = FigureCanvasTkAgg(self.figure, master=self)
self.axis = self.figure.add_subplot(111)
self.canvas.draw()
canvas_widget = self.canvas.get_tk_widget()
canvas_widget.grid(row=0, column=0, sticky=tk.N + tk.W + tk.E + tk.S)
self.canvas_cursor = Cursor(self.axis, tk.StringVar(master=self.root))
self.canvas.mpl_connect('motion_notify_event', self.canvas_cursor.mouse_move)
self.span = SpanSelector(
self.axis, self.zoom, 'horizontal', useblit=True,
rectprops=dict(alpha=0.5, facecolor='red'))
self.mz_span = None
self.scan = None
self.annotations = []
self.canvas.draw()
示例10: configure_treeview
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def configure_treeview(self):
self.treeview = ttk.Treeview(self)
self.treeview['columns'] = ["id", "time", 'ms_level', 'precursor_mz', 'precursor_charge', 'activation']
self.treeview.grid(row=2, column=0, sticky=tk.S + tk.W + tk.E + tk.N)
self.treeview_scrollbar = ttk.Scrollbar(self, orient="vertical", command=self.treeview.yview)
self.treeview_scrollbar.grid(row=2, column=0, sticky=tk.S + tk.E + tk.N)
self.treeview.configure(yscrollcommand=self.treeview_scrollbar.set)
self.treeview.heading('id', text="Scan ID")
self.treeview.heading('#0', text='Index')
self.treeview.heading("time", text='Time (min)')
self.treeview.heading("ms_level", text='MS Level')
self.treeview.heading("precursor_mz", text='Precursor M/Z')
self.treeview.heading("precursor_charge", text='Precursor Z')
self.treeview.heading("activation", text='Activation')
self.treeview.column("#0", width=75)
self.treeview.column("ms_level", width=75)
self.treeview.column("time", width=75)
self.treeview.column("precursor_mz", width=100)
self.treeview.column("precursor_charge", width=100)
self.treeview.bind("<<TreeviewSelect>>", self.on_row_click)
示例11: table
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def table(self, master, title, content, target=None, backgroundcolour="White", foregroundcolour="black", bordercolour="grey", borderwidth=1, fontstyle="DejaVuSans 18 normal"):
# creates a table from a 2 dimensional array.
# master: = this represents the parent window
# content: a 2 dimensional array containing the table contents
# First column in the array must be the row id which is returned on a click event. This will not be displayed in the table
index = 0
for i in range(len(content)): #Rows
for j in range(len(content[i])):
if j==0:
index = content[i][j]
else:
b = tk.Label(master, text=str(content[i][j]), background=backgroundcolour, foreground=foregroundcolour,padx=5, pady=10, highlightthickness=borderwidth, highlightbackground=bordercolour, font=fontstyle)
if (target is not None):
b.bind('<ButtonPress-1>', self.__row_pressed)
b.bind('<ButtonRelease-1>', lambda event, arg1=index, arg2=target: self.__row_released(event, arg1, arg2))
b.grid(row=i, column=j-1, sticky=tk.N+tk.S+tk.E+tk.W)
return
示例12: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def __init__(self, parent, text, textvariable, **kwargs):
super().__init__(parent, **kwargs)
self.label = tk.Label(self,
text=text,
font=self.font,
anchor=tk.E)
self.entry = tk.Entry(self,
textvariable=textvariable,
font=self.font,
width=len("$ 000.00"),
state=tk.DISABLED,
disabledforeground="black",
disabledbackground="white")
self.label.grid(row=0, column=0, sticky="nswe")
self.entry.grid(row=0, column=1, sticky="nswe")
示例13: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def create_widgets(self):
''' Creates all widgets.
'''
self.grid_rowconfigure(0, weight=1)
self.grid_columnconfigure(0, weight=1)
xscrollbar = Scrollbar(self, orient=HORIZONTAL)
xscrollbar.grid(row=1, column=0, sticky=E+W)
yscrollbar = Scrollbar(self)
yscrollbar.grid(row=0, column=1, sticky=N+S)
self.text = Text(self, wrap=NONE,
xscrollcommand=xscrollbar.set,
yscrollcommand=yscrollbar.set)
self.text.bind("<Control-Key-a>", self.select_all)
self.text.bind("<Control-Key-A>", self.select_all)
self.text.grid(row=0, column=0, sticky=N+S+E+W)
xscrollbar.config(command=self.text.xview)
yscrollbar.config(command=self.text.yview)
示例14: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def create_widgets(self, names):
''' Creates appropriate widgets.
Args:
names (list of str): list of available sheet names.
'''
sheet_name_lbl = Label(self,
text='Choose sheet name where data is stored:')
sheet_name_lbl.grid(sticky=N+W, padx=5, pady=5)
sheet_names_box = Combobox(self, state="readonly", width=20,
textvariable=self.sheet_name_str,
values=names)
sheet_names_box.current(0)
sheet_names_box.grid(row=1, column=0, columnspan=2,
sticky=N+W, padx=5, pady=5)
ok_btn = Button(self, text='OK', command=self.ok)
ok_btn.grid(row=2, column=0, sticky=N+E, padx=5, pady=5)
ok_btn.bind('<Return>', self.ok)
ok_btn.focus()
cancel_btn = Button(self, text='Cancel', command=self.cancel)
cancel_btn.grid(row=2, column=1, sticky=N+E, padx=5, pady=5)
cancel_btn.bind('<Return>', self.cancel)
示例15: create_layout
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import E [as 别名]
def create_layout(self):
padWE = dict(sticky=(tk.W, tk.E), padx="0.5m", pady="0.5m")
self.currencyFromCombobox.grid(row=0, column=0, **padWE)
self.amountSpinbox.grid(row=0, column=1, **padWE)
self.currencyToCombobox.grid(row=1, column=0, **padWE)
self.resultLabel.grid(row=1, column=1, **padWE)
self.grid(row=0, column=0, sticky=(tk.N, tk.S, tk.E, tk.W))
self.columnconfigure(0, weight=2)
self.columnconfigure(1, weight=1)
self.master.columnconfigure(0, weight=1)
self.master.rowconfigure(0, weight=1)
self.master.minsize(150, 40)