本文整理汇总了Python中tkinter.NS属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.NS属性的具体用法?Python tkinter.NS怎么用?Python tkinter.NS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.NS属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NS [as 别名]
def __init__(self, parent, header, width=10, selectmode=tk.BROWSE):
tk.Frame.__init__(self, parent)
self.parent = parent
self.num_f = len(header)
self.headers = []
self.lbs = []
self.c = 0
self.sel_idxs = []
self.scroll = tk.Scrollbar(self, orient=tk.VERTICAL)
for i in range(0, self.num_f):
self.headers.append(tk.Label(self, text=header[i]))
self.headers[-1].grid(row=0, column=self.c, sticky=tk.EW)
self.lbs.append(tk.Listbox(self, width=width, selectmode=selectmode, yscrollcommand=self.yscroll, bg='white'))
self.lbs[-1].grid(row=1, column=self.c, sticky=tk.EW)
self.lbs[-1].bind("<<ListboxSelect>>", self.select)
self.c += 1
self.scroll.config(command=self.lbs[0].yview)
self.scroll.grid(row=1, column=self.c, sticky=tk.NS)
示例2: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NS [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)
示例3: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import NS [as 别名]
def __init__(self, master):
super().__init__(master)
# Get the username and save list of found files.
self.__user = getpass.getuser()
self.__dirlist = set()
# Create widgets.
self.__log = tkinter.Text(self)
self.__bar = tkinter.ttk.Scrollbar(self, orient=tkinter.VERTICAL,
command=self.__log.yview)
self.__ent = tkinter.ttk.Entry(self, cursor='xterm')
# Configure widgets.
self.__log.configure(state=tkinter.DISABLED, wrap=tkinter.WORD,
yscrollcommand=self.__bar.set)
# Create binding.
self.__ent.bind('<Return>', self.create_message)
# Position widgets.
self.__log.grid(row=0, column=0, sticky=tkinter.NSEW)
self.__bar.grid(row=0, column=1, sticky=tkinter.NS)
self.__ent.grid(row=1, column=0, columnspan=2, sticky=tkinter.EW)
# Configure resizing.
self.grid_rowconfigure(0, weight=1)
self.grid_columnconfigure(0, weight=1)
# Focus entry.
self.__ent.focus_set()
# Schedule message discovery.
self.after_idle(self.get_messages)