本文整理匯總了Python中Tkinter.N屬性的典型用法代碼示例。如果您正苦於以下問題:Python Tkinter.N屬性的具體用法?Python Tkinter.N怎麽用?Python Tkinter.N使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類Tkinter
的用法示例。
在下文中一共展示了Tkinter.N屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __createWidgets
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [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: configure_canvas
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [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()
示例3: configure_treeview
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [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)
示例4: license_display
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [as 別名]
def license_display(self, *event):
# Function to display license dialog on app start
license_string = ("Copyright (c) 2019, Donald N. Bockoven III\n"
"All rights reserved.\n\n"
"THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\""
" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE"
" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE"
" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE"
" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL"
" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR"
" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER"
" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,"
" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE"
" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n"
"https://github.com/buddyd16/Structural-Engineering/blob/master/LICENSE"
)
tkMessageBox.showerror("License Information",license_string)
self.master.focus_force()
示例5: __init__
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [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)
示例6: addDatePickerEntry
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [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
示例7: addDatePickerEntry
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [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)
entry.bindPickButton(pickButton)
return entry
示例8: _set_up_tree_widget
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [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: add_measurements
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [as 別名]
def add_measurements(self, master):
self.timeStepInSeconds = self.addEntry(master, "Time Step In Seconds:", validation.ValidatePositiveInteger(master), self.config.timeStepInSeconds)
self.badData = self.addEntry(master, "Bad Data Value:", validation.ValidateFloat(master), self.config.badData)
self.dateFormat = self.addEntry(master, "Date Format:", validation.ValidateNotBlank(master), self.config.dateFormat, width = 60)
pickDateFormatButton = tk.Button(master, text=".", command = base_dialog.DateFormatPicker(self, self.dateFormat, ['%Y-%m-%d %H:%M:%S', '%Y-%m-%dT%H:%M:%S', '%d-%m-%y %H:%M', '%y-%m-%d %H:%M', '%d/%m/%Y %H:%M', '%d/%m/%Y %H:%M:%S', '%d/%m/%y %H:%M', '%y/%m/%d %H:%M']), width=5, height=1)
pickDateFormatButton.grid(row=(self.row-1), sticky=tk.E+tk.N, column=self.buttonColumn)
self.timeStamp = self.addPickerEntry(master, "Time Stamp:", validation.ValidateNotBlank(master), self.config.timeStamp, width = 60)
self.turbineLocationWindSpeed = self.addPickerEntry(master, "Turbine Location Wind Speed:", None, self.config.turbineLocationWindSpeed, width = 60) #Should this be with reference wind speed?
self.hubWindSpeed = self.addPickerEntry(master, "Hub Wind Speed:", None, self.config.hubWindSpeed, width = 60)
self.hubTurbulence = self.addPickerEntry(master, "Hub Turbulence:", None, self.config.hubTurbulence, width = 60)
self.temperature = self.addPickerEntry(master, "Temperature:", None, self.config.temperature, width = 60)
self.pressure = self.addPickerEntry(master, "Pressure:", None, self.config.pressure, width = 60)
self.density = self.addPickerEntry(master, "Density:", None, self.config.density, width = 60)
self.inflowAngle = self.addPickerEntry(master, "Inflow Angle:", None, self.config.inflowAngle, width = 60)
self.inflowAngle.setTip('Not required')
示例10: add_rews
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [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: do_layout
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [as 別名]
def do_layout(self):
self.grid(sticky=tk.N + tk.W + tk.E + tk.S)
tk.Grid.rowconfigure(self, 0, weight=1)
tk.Grid.columnconfigure(self, 0, weight=1)
示例12: __run__
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [as 別名]
def __run__(self):
# create the welcome window
run_type = None
t = tkinter.Toplevel(self.root)
t.resizable(False,False)
frame = ttk.Frame(t, padding="3 3 12 12")
frame.grid(column=0, row=0, sticky=(tkinter.N, tkinter.W, tkinter.E, tkinter.S))
frame.columnconfigure(0, weight=1)
frame.rowconfigure(0, weight=1)
ttk.Label(frame,text="Welcome to Marmot.").grid(column=1,row=1)
def setup(require_gold_standard):
# this will determine the whole run mode from here on in
self.require_gold_standard = require_gold_standard
self.subjects = self.__image_select__(require_gold_standard)
# if r == "a":
# self.subjects = self.project.__get_retired_subjects__(1,True)
# self.run_mode = "a"
# else:
# # when we want to explore subjects which don't have gold standard
# # basically creating some as we go
# # False => read in all subjects, not just those with gold standard annotations
# # todo - takes a while in read in all subjects. Better way?
# self.subjects = self.project.__get_retired_subjects__(1,False)
# self.run_mode = "b"
random.shuffle(self.subjects)
self.__thumbnail_display__()
self.__add_buttons__()
t.destroy()
ttk.Button(frame, text="Explore results using existing expert annotations", command = lambda : setup(True)).grid(column=1, row=2)
ttk.Button(frame, text="Explore and create gold standard on the fly", command = lambda : setup(False)).grid(column=1, row=3)
t.lift(self.root)
# self.outputButtons()
self.root.mainloop()
示例13: addPickerEntry
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [as 別名]
def addPickerEntry(self, master, title, validation, value, width = None):
entry = self.addEntry(master, title, validation, value, width = width)
pickButton = tk.Button(master, text=".", command = ColumnPicker(self, entry), width=5, height=1)
pickButton.grid(row=(self.row-1), sticky=tk.E+tk.N, column=self.buttonColumn)
entry.bindPickButton(pickButton)
return entry
示例14: addListBox
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [as 別名]
def addListBox(self, master, title):
scrollbar = tk.Scrollbar(master, orient=tk.VERTICAL)
tipLabel = tk.Label(master, text="")
tipLabel.grid(row = self.row, sticky=tk.W, column=self.tipColumn)
lb = tk.Listbox(master, yscrollcommand=scrollbar, selectmode=tk.EXTENDED, height=3)
self.listboxEntries[title] = ListBoxEntry(lb,scrollbar,tipLabel)
self.row += 1
self.listboxEntries[title].scrollbar.configure(command=self.listboxEntries[title].listbox.yview)
self.listboxEntries[title].scrollbar.grid(row=self.row, sticky=tk.W+tk.N+tk.S, column=self.titleColumn)
return self.listboxEntries[title]
示例15: addListBox
# 需要導入模塊: import Tkinter [as 別名]
# 或者: from Tkinter import N [as 別名]
def addListBox(self, master, title, height = 3):
scrollbar = tk.Scrollbar(master, orient=tk.VERTICAL)
tipLabel = tk.Label(master, text="")
tipLabel.grid(row = self.row, sticky=tk.W, column=self.tipColumn)
lb = tk.Listbox(master, yscrollcommand=scrollbar, selectmode=tk.EXTENDED, height=height)
self.listboxEntries[title] = ListBoxEntry(lb,scrollbar,tipLabel)
self.row += 1
self.listboxEntries[title].scrollbar.configure(command=self.listboxEntries[title].listbox.yview)
self.listboxEntries[title].scrollbar.grid(row=self.row, sticky=tk.W+tk.N+tk.S, column=self.titleColumn)
return self.listboxEntries[title]