本文整理汇总了Python中tkinter.NSEW属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.NSEW属性的具体用法?Python tkinter.NSEW怎么用?Python tkinter.NSEW使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.NSEW属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def create_widgets(self):
'''Create the tkinter UI'''
self.grid_columnconfigure(0, weight=1)
self.grid_columnconfigure(1, weight=1)
self.grid_rowconfigure(0, weight=1)
self.flash_led_button = tk.Button(self)
self.flash_led_button["text"] = "Flash LED"
self.flash_led_button["command"] = self.flash_led
self.flash_led_button.grid(
row=0, column=0, padx=3, pady=3, sticky=tk.NSEW)
quit_button = tk.Button(self)
quit_button["text"] = "Quit"
quit_button["command"] = self.master.destroy
quit_button.grid(
row=0, column=1, padx=3, pady=3, sticky=tk.NSEW)
# Start the example if this module is being run
示例2: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def __init__(self, master=None):
super(CInScan02, self).__init__(master)
self.board_num = 0
self.ctr_props = CounterProps(self.board_num)
chan = next(
(channel for channel in self.ctr_props.counter_info
if channel.type == CounterChannelType.CTRSCAN), None)
if chan != None:
self.chan_num = chan.channel_num
else:
self.chan_num = -1
# Initialize tkinter
self.grid(sticky=tk.NSEW)
self.grid_columnconfigure(0, weight=1)
self.grid_rowconfigure(0, weight=1)
self.create_widgets()
示例3: main
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def main(cls):
# Create and configure the root.
tkinter.NoDefaultRoot()
root = tkinter.Tk()
root.title('Logos')
root.minsize(200, 200)
# Create Logos and setup for resizing.
view = cls(root)
view.grid(row=0, column=0, sticky=tkinter.NSEW)
root.grid_rowconfigure(0, weight=1)
root.grid_columnconfigure(0, weight=1)
# Enter the main GUI event loop.
root.mainloop()
########################################################################
# These are all instance methods.
示例4: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def __init__(self, master):
# Initialize the Frame object.
super().__init__(master)
# Create every opening widget.
self.intro = Label(self, text=self.PROMPT)
self.group = LabelFrame(self, text='Filename')
self.entry = Entry(self.group, width=35)
self.click = Button(self.group, text='Browse ...', command=self.file)
self.enter = Button(self, text='Continue', command=self.start)
# Make Windows entry bindings.
def select_all(event):
event.widget.selection_range(0, tkinter.END)
return 'break'
self.entry.bind('<Control-Key-a>', select_all)
self.entry.bind('<Control-Key-/>', lambda event: 'break')
# Position them in this frame.
options = {'sticky': tkinter.NSEW, 'padx': 5, 'pady': 5}
self.intro.grid(row=0, column=0, **options)
self.group.grid(row=1, column=0, **options)
self.entry.grid(row=0, column=0, **options)
self.click.grid(row=0, column=1, **options)
self.enter.grid(row=2, column=0, **options)
示例5: show_data
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def show_data(data):
# Setup the root UI
root = tk.Tk()
root.title("JSON viewer")
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
# Setup the Frames
tree_frame = ttk.Frame(root, padding="3")
tree_frame.grid(row=0, column=0, sticky=tk.NSEW)
# Setup the Tree
tree = ttk.Treeview(tree_frame, columns='Values')
tree.tag_configure("d", foreground='blue')
tree.column('Values', width=100)
tree.heading('Values', text='Values')
json_tree(tree, '', data)
tree.pack(fill=tk.BOTH, expand=1)
# Limit windows minimum dimensions
root.update_idletasks()
root.minsize(500, 500)
raise_app()
root.mainloop()
示例6: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def __init__(self, app, master):
super().__init__(master, text="Playlist", padding=4)
self.app = app
bf = ttk.Frame(self)
ttk.Button(bf, text="Move to Top", width=11, command=self.do_to_top).pack()
ttk.Button(bf, text="Move Up", width=11, command=self.do_move_up).pack()
ttk.Button(bf, text="Move Down", width=11, command=self.do_move_down).pack()
ttk.Button(bf, text="Remove", width=11, command=self.do_remove).pack()
bf.pack(side=tk.LEFT, padx=4)
sf = ttk.Frame(self)
cols = [("title", 300), ("artist", 180), ("album", 180), ("length", 80)]
self.listTree = ttk.Treeview(sf, columns=[col for col, _ in cols], height=10, show="headings")
vsb = ttk.Scrollbar(orient="vertical", command=self.listTree.yview)
self.listTree.configure(yscrollcommand=vsb.set)
self.listTree.grid(column=1, row=0, sticky=tk.NSEW, in_=sf)
vsb.grid(column=0, row=0, sticky=tk.NS, in_=sf)
for col, colwidth in cols:
self.listTree.heading(col, text=col.title())
self.listTree.column(col, width=colwidth)
sf.grid_columnconfigure(0, weight=1)
sf.grid_rowconfigure(0, weight=1)
sf.pack(side=tk.LEFT, padx=4)
示例7: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def __init__(self, master):
ttk.Frame.__init__(self, master)
# set up scrolling with canvas
vscrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL)
self.canvas = tk.Canvas(self, bd=0, highlightthickness=0, yscrollcommand=vscrollbar.set)
vscrollbar.config(command=self.canvas.yview)
self.canvas.xview_moveto(0)
self.canvas.yview_moveto(0)
self.canvas.grid(row=0, column=0, sticky=tk.NSEW)
vscrollbar.grid(row=0, column=1, sticky=tk.NSEW)
self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=1)
self.interior = ttk.Frame(self.canvas)
self.interior_id = self.canvas.create_window(0, 0, window=self.interior, anchor=tk.NW)
self.bind("<Configure>", self._configure_interior, "+")
self.bind("<Expose>", self._expose, "+")
示例8: set_gutter_visibility
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def set_gutter_visibility(self, value):
if value and not self._gutter_is_gridded:
self._gutter.grid(row=0, column=0, sticky=tk.NSEW)
self._gutter_is_gridded = True
elif not value and self._gutter_is_gridded:
self._gutter.grid_forget()
self._gutter_is_gridded = False
else:
return
"""
# insert first line number (NB! Without trailing linebreak. See update_gutter)
self._gutter.config(state="normal")
self._gutter.delete("1.0", "end")
for content, tags in self.compute_gutter_line(self._first_line_number):
self._gutter.insert("end", content, ("content",) + tags)
self._gutter.config(state="disabled")
"""
self.update_gutter(True)
示例9: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def __init__(self, master):
self._state = "idle" # possible values: "listing", "fetching", "idle"
self._process = None
self._active_distributions = {}
self.current_package_data = None
super().__init__(master)
main_frame = ttk.Frame(self)
main_frame.grid(sticky=tk.NSEW, ipadx=15, ipady=15)
self.rowconfigure(0, weight=1)
self.columnconfigure(0, weight=1)
self.title(self._get_title())
self._create_widgets(main_frame)
self.search_box.focus_set()
self.bind("<Escape>", self._on_close, True)
self.protocol("WM_DELETE_WINDOW", self._on_close)
self._show_instructions()
self._start_update_list()
示例10: _init_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def _init_widgets(self):
# init and place scrollbar
self.vert_scrollbar = SafeScrollbar(self, orient=tk.VERTICAL)
self.vert_scrollbar.grid(row=0, column=1, sticky=tk.NSEW)
# init and place tree
self.tree = ttk.Treeview(self, yscrollcommand=self.vert_scrollbar.set)
self.tree.grid(row=0, column=0, sticky=tk.NSEW)
self.vert_scrollbar["command"] = self.tree.yview
# set single-cell frame
self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=1)
# init tree events
self.tree.bind("<<TreeviewSelect>>", self._on_select, True)
self.tree.bind("<Map>", self._update_frame_contents, True)
# configure the only tree column
self.tree.column("#0", anchor=tk.W, stretch=True)
# self.tree.heading('#0', text='Item (type @ line)', anchor=tk.W)
self.tree["show"] = ("tree",)
self._class_img = get_workbench().get_image("outline-class")
self._method_img = get_workbench().get_image("outline-method")
示例11: update_type_specific_info
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def update_type_specific_info(self, object_info):
content_inspector = None
for insp in self.content_inspectors:
if insp.applies_to(object_info):
content_inspector = insp
break
# print("TYPSE", content_inspector)
if content_inspector != self.current_content_inspector:
if self.current_content_inspector is not None:
self.current_content_inspector.grid_remove() # TODO: or forget?
self.current_content_inspector = None
if content_inspector is not None:
content_inspector.grid(row=0, column=0, sticky=tk.NSEW, padx=(0, 0))
self.current_content_inspector = content_inspector
if self.current_content_inspector is not None:
self.current_content_inspector.set_object_info(object_info)
示例12: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [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)
示例13: set_sample_selector
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def set_sample_selector(self):
if self.sample_selector:
self.sample_selector.destroy()
self.sample_selector = gw.SampleSelector(self, self.par.run.samples, ped=self.par.run.ped)
self.sample_selector.grid(row=1, column=0, sticky=tk.NSEW, padx=10)
示例14: set_genotype_selector
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def set_genotype_selector(self):
if self.genotype_selector:
self.genotype_selector.destroy()
self.genotype_selector = gw.SampleGenotypeSelector(self, self.current_samples)
self.genotype_selector.grid(row=1, column=1, sticky=tk.NSEW, padx=10)
示例15: set_filters
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NSEW [as 别名]
def set_filters(self):
if self.filters:
self.filters.destroy()
self.filters = gw.Filters(self)
self.filters.grid(row=3, column=0, columnspan=2, sticky=tk.NSEW, pady=2, padx=10)