本文整理汇总了Python中Tkinter.W属性的典型用法代码示例。如果您正苦于以下问题:Python Tkinter.W属性的具体用法?Python Tkinter.W怎么用?Python Tkinter.W使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类Tkinter
的用法示例。
在下文中一共展示了Tkinter.W属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __createWidgets
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [as 别名]
def __createWidgets(self):
"""Create the widgets. """
if self.__is_verbose: print "INFO: Creating Widgets!"
# create show preview button
self.preview_button = tk.Button(self, text = "Show Camera Feed",
command = self.clickStartPreview)
self.preview_button.grid(row = 1, column = 0,
sticky = tk.W + tk.E + tk.N + tk.S)
# create quit button
self.quit_button = tk.Button(self, text = "Quit",
command = self.clickQuit)
self.quit_button.grid(row = 1, column = 1,
sticky = tk.W + tk.E + tk.N + tk.S)
# --------------------------------------------------------------------------
# Load Image
# --------------------------------------------------------------------------
示例2: build
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [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)
示例3: plugin_prefs
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [as 别名]
def plugin_prefs(parent, cmdr, is_beta):
PADX = 10
BUTTONX = 12 # indent Checkbuttons and Radiobuttons
PADY = 2 # close spacing
output = config.getint('output') or (config.OUT_MKT_EDDN | config.OUT_SYS_EDDN) # default settings
eddnframe = nb.Frame(parent)
HyperlinkLabel(eddnframe, text='Elite Dangerous Data Network', background=nb.Label().cget('background'), url='https://github.com/EDSM-NET/EDDN/wiki', underline=True).grid(padx=PADX, sticky=tk.W) # Don't translate
this.eddn_station= tk.IntVar(value = (output & config.OUT_MKT_EDDN) and 1)
this.eddn_station_button = nb.Checkbutton(eddnframe, text=_('Send station data to the Elite Dangerous Data Network'), variable=this.eddn_station, command=prefsvarchanged) # Output setting
this.eddn_station_button.grid(padx=BUTTONX, pady=(5,0), sticky=tk.W)
this.eddn_system = tk.IntVar(value = (output & config.OUT_SYS_EDDN) and 1)
this.eddn_system_button = nb.Checkbutton(eddnframe, text=_('Send system and scan data to the Elite Dangerous Data Network'), variable=this.eddn_system, command=prefsvarchanged) # Output setting new in E:D 2.2
this.eddn_system_button.grid(padx=BUTTONX, pady=(5,0), sticky=tk.W)
this.eddn_delay= tk.IntVar(value = (output & config.OUT_SYS_DELAY) and 1)
this.eddn_delay_button = nb.Checkbutton(eddnframe, text=_('Delay sending until docked'), variable=this.eddn_delay) # Output setting under 'Send system and scan data to the Elite Dangerous Data Network' new in E:D 2.2
this.eddn_delay_button.grid(padx=BUTTONX, sticky=tk.W)
return eddnframe
示例4: configure_canvas
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [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()
示例5: configure_treeview
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [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)
示例6: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [as 别名]
def __init__(self, master=None, cnf=None, **kwargs):
self.frame = ttk.Frame(master)
self.frame.grid_rowconfigure(0, weight=1)
self.frame.grid_columnconfigure(0, weight=1)
self.xbar = AutoScrollbar(self.frame, orient=tkinter.HORIZONTAL)
self.xbar.grid(row=1, column=0,
sticky=tkinter.E + tkinter.W)
self.ybar = AutoScrollbar(self.frame)
self.ybar.grid(row=0, column=1,
sticky=tkinter.S + tkinter.N)
tkinter.Canvas.__init__(self, self.frame, cnf or {},
xscrollcommand=self.xbar.set,
yscrollcommand=self.ybar.set,
**kwargs)
tkinter.Canvas.grid(self, row=0, column=0,
sticky=tkinter.E + tkinter.W + tkinter.N + tkinter.S)
self.xbar.config(command=self.xview)
self.ybar.config(command=self.yview)
self.bind("<MouseWheel>", self.on_mousewheel)
示例7: addDatePickerEntry
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [as 别名]
def addDatePickerEntry(self, master, title, validation, value, width = None):
if value != None:
if type(value) == str:
textValue = value
else:
textValue = value.strftime(datePickerFormat)
else:
textValue = None
entry = self.addEntry(master, title + " " + datePickerFormatDisplay, validation, textValue, width = width)
entry.entry.config(state=tk.DISABLED)
pickButton = tk.Button(master, text=".", command = DatePicker(self, entry, datePickerFormat), width=3, height=1)
pickButton.grid(row=(self.row-1), sticky=tk.N, column=self.inputColumn, padx = 160)
clearButton = tk.Button(master, text="x", command = ClearEntry(entry), width=3, height=1)
clearButton.grid(row=(self.row-1), sticky=tk.W, column=self.inputColumn, padx = 133)
entry.bindPickButton(pickButton)
return entry
示例8: _set_up_tree_widget
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [as 别名]
def _set_up_tree_widget(self):
tree_container = ttk.Frame(self.container)
tree_container.grid(row=0, column=0, sticky=tk.W+tk.E+tk.N+tk.S)
#tree_container.pack(fill='both', expand=True)
# create a treeview with dual scrollbars
self.tree = ttk.Treeview(tree_container, columns=self.headers, show="headings")
vsb = ttk.Scrollbar(tree_container, orient="vertical", command=self.tree.yview)
hsb = ttk.Scrollbar(tree_container, orient="horizontal", command=self.tree.xview)
self.tree.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set)
self.tree.grid(column=0, row=0, sticky='nsew')
vsb.grid(column=1, row=0, sticky='ns')
hsb.grid(column=0, row=1, sticky='ew')
tree_container.grid_columnconfigure(0, weight=1)
tree_container.grid_rowconfigure(0, weight=1)
self.tree.bind("<Double-1>", self.double_click)
示例9: body
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [as 别名]
def body(self, master):
self.prepareColumns(master)
#dummy label to force width
tk.Label(master, text=" " * 275).grid(row = self.row, sticky=tk.W, column=self.titleColumn, columnspan = 8)
self.row += 1
self.addTitleRow(master, "Exclusion Settings:")
self.startDate = self.addDatePickerEntry(master, "Start Date:", validation.ValidateNotBlank(master), self.item.startDate)
self.endDate = self.addDatePickerEntry(master, "End Date:", validation.ValidateNotBlank(master), self.item.endDate)
if self.item.active:
self.active = self.addCheckBox(master, "Active:", 1)
else:
self.active = self.addCheckBox(master, "Active:", 0)
#dummy label to indent controls
tk.Label(master, text=" " * 5).grid(row = (self.row-1), sticky=tk.W, column=self.titleColumn)
示例10: add_rews
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [as 别名]
def add_rews(self, master):
self.addTitleRow(master, "REWS Settings:")
self.rewsDefined = self.addCheckBox(master, "REWS Active", self.config.rewsDefined)
self.numberOfRotorLevels = self.addEntry(master, "REWS Number of Rotor Levels:", validation.ValidateNonNegativeInteger(master), self.config.numberOfRotorLevels)
self.rotorMode = self.addOption(master, "REWS Rotor Mode:", ["EvenlySpacedLevels", "ProfileLevels"], self.config.rotorMode)
self.hubMode = self.addOption(master, "Hub Mode:", ["Interpolated", "PiecewiseExponent"], self.config.hubMode)
label = tk.Label(master, text="REWS Profile Levels:")
label.grid(row=self.row, sticky=tk.W, column=self.titleColumn, columnspan = 2)
self.row += 1
self.rewsGridBox = REWSGridBox(master, self, self.row, self.inputColumn)
self.rewsGridBox.add_items(self.config.rewsProfileLevels)
self.copyToShearButton = tk.Button(master, text="Copy To Shear", command = self.copyToShearREWSProfileLevels, width=12, height=1)
self.copyToShearButton.grid(row=self.row, sticky=tk.E+tk.N, column=self.buttonColumn)
示例11: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [as 别名]
def __init__(self, master = None):
"""Application constructor method. """
if self.__is_verbose: print "INFO: Application constructor called."
# run super constructor method
tk.Frame.__init__(self, master)
# apply grid layout
self.grid()
# give application a reference to the global camera object
global camera
self.__camera = camera
self.__camera.awb_mode = 'auto'
self.__camera.exposure_mode = 'auto'
# populate the application WITH W-W-W-WWIDDDDGEETTSS
self.__createWidgets()
# create canvas to display logo
self.logo = tk.Canvas(self, width = 400, height = 148)
self.logo.grid(row = 0, column = 0, rowspan = 1, columnspan = 2)
self.loadImage("./images/logo_main.jpeg", self.logo, 400/2, 148/2)
self.updateText()
# create key-press handlers -> set focus to this frame
self.bind("<Escape>", self.escapePressHandler)
self.focus_set()
示例12: mul_qq
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [as 别名]
def mul_qq(qa, qb):
return np.array([qa[0]*qb[0] - qa[1]*qb[1] - qa[2]*qb[2] - qa[3]*qb[3],
qa[0]*qb[1] + qa[1]*qb[0] + qa[2]*qb[3] - qa[3]*qb[2],
qa[0]*qb[2] + qa[2]*qb[0] + qa[3]*qb[1] - qa[1]*qb[3],
qa[0]*qb[3] + qa[3]*qb[0] + qa[1]*qb[2] - qa[2]*qb[1]])
# Generate a normalized quaternion [W,X,Y,Z] from [X,Y,Z]
示例13: _make_slider
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [as 别名]
def _make_slider(self, parent, rowidx, label, inival):
# Set limits and resolution.
lim = 1.0
res = 0.001
# Create shared variable.
tkvar = tk.DoubleVar()
tkvar.set(inival)
# Set a callback for whenever tkvar is changed.
# (The 'command' callback on the SpinBox only applies to the buttons.)
tkvar.trace('w', self._update_callback)
# Create the Label, SpinBox, and Scale objects.
label = tk.Label(parent, text=label)
spbox = tk.Spinbox(parent,
textvariable=tkvar,
from_=-lim, to=lim, increment=res)
slide = tk.Scale(parent,
orient=tk.HORIZONTAL,
showvalue=0,
variable=tkvar,
from_=-lim, to=lim, resolution=res)
label.grid(row=rowidx, column=0, sticky='W')
spbox.grid(row=rowidx, column=1)
slide.grid(row=rowidx, column=2)
return tkvar
# Thin wrapper for update_preview(), used to strip Tkinter arguments.
示例14: _make_file_select
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [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.
示例15: addpagerow
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import W [as 别名]
def addpagerow(self, parent, content, align=None):
for i in range(len(content)):
label = nb.Label(parent, text=content[i])
if i == 0:
label.grid(padx=10, sticky=tk.W)
row = parent.grid_size()[1]-1
elif align is None and i == len(content) - 1: # Assumes last column right justified if unspecified
label.grid(row=row, column=i, padx=10, sticky=tk.E)
else:
label.grid(row=row, column=i, padx=10, sticky=align or tk.W)