本文整理汇总了Python中Tkinter.VERTICAL属性的典型用法代码示例。如果您正苦于以下问题:Python Tkinter.VERTICAL属性的具体用法?Python Tkinter.VERTICAL怎么用?Python Tkinter.VERTICAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类Tkinter
的用法示例。
在下文中一共展示了Tkinter.VERTICAL属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import VERTICAL [as 别名]
def __init__(self, parent, property_dict, *args, **kw):
tk.Frame.__init__(self, parent, *args, **kw)
# create a canvas object and a vertical scrollbar for scrolling it
self.vscrollbar = vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL)
vscrollbar.pack(fill=tk.Y, side=tk.RIGHT, expand=tk.FALSE)
self.canvas = canvas = tk.Canvas(self, bd=0, highlightthickness=0,
yscrollcommand=vscrollbar.set)
canvas.pack(side=tk.LEFT, fill=tk.BOTH, expand=tk.TRUE)
vscrollbar.config(command=canvas.yview)
# reset the view
canvas.xview_moveto(0)
canvas.yview_moveto(0)
# create a frame inside the canvas which will be scrolled with it
self.interior = interior = tk.Frame(canvas)
self.interior_id = canvas.create_window(0, 0, window=interior,
anchor='nw')
self.interior.bind('<Configure>', self._configure_interior)
self.canvas.bind('<Configure>', self._configure_canvas)
self.build(property_dict)
示例2: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import VERTICAL [as 别名]
def __init__(self, master, textvariable=None, *args, **kwargs):
tk.Frame.__init__(self, master)
# Init GUI
self._y_scrollbar = tk.Scrollbar(self, orient=tk.VERTICAL)
self._text_widget = tk.Text(self, yscrollcommand=self._y_scrollbar.set, *args, **kwargs)
self._text_widget.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
self._y_scrollbar.config(command=self._text_widget.yview)
self._y_scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
if textvariable is not None:
if not isinstance(textvariable, tk.Variable):
raise TypeError("tkinter.Variable type expected, {} given.".format(
type(textvariable)))
self._text_variable = textvariable
self.var_modified()
self._text_trace = self._text_widget.bind('<<Modified>>', self.text_modified)
self._var_trace = textvariable.trace("w", self.var_modified)
示例3: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import VERTICAL [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)
示例4: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import VERTICAL [as 别名]
def __init__(self, master, factor = 0.5, **kwargs):
self.__scrollableWidgets = []
if 'orient' in kwargs:
if kwargs['orient']== tk.VERTICAL:
self.__orientLabel = 'y'
elif kwargs['orient']== tk.HORIZONTAL:
self.__orientLabel = 'x'
else:
raise Exception("Bad 'orient' argument in scrollbar.")
else:
self.__orientLabel = 'y'
kwargs['command'] = self.onScroll
self.factor = factor
ttk.Scrollbar.__init__(self, master, **kwargs)
示例5: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import VERTICAL [as 别名]
def __init__(self, parent):
scrollbar = tk.Scrollbar(parent, orient=tk.VERTICAL)
self.listbox = tk.Listbox(parent, yscrollcommand=scrollbar.set, selectmode=tk.EXTENDED)
scrollbar.configure(command=self.listbox.yview)
self.listbox.pack(side=tk.LEFT,fill=tk.BOTH, expand=1, pady=5)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y, pady=5)
示例6: addListBox
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import VERTICAL [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]
示例7: addListBox
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import VERTICAL [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]
示例8: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import VERTICAL [as 别名]
def __init__(self):
root = tk.Tk()
root.title('OpenCV Demo')
self.win = win = tk.PanedWindow(root, orient=tk.HORIZONTAL, sashrelief=tk.RAISED, sashwidth=4)
self.win.pack(fill=tk.BOTH, expand=1)
left = tk.Frame(win)
right = tk.Frame(win)
win.add(left)
win.add(right)
scrollbar = tk.Scrollbar(left, orient=tk.VERTICAL)
self.demos_lb = demos_lb = tk.Listbox(left, yscrollcommand=scrollbar.set)
scrollbar.config(command=demos_lb.yview)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
demos_lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
self.samples = {}
for fn in glob('*.py'):
name = splitfn(fn)[1]
if fn[0] != '_' and name not in exclude_list:
demos_lb.insert(tk.END, name)
self.samples[name] = fn
demos_lb.bind('<<ListboxSelect>>', self.on_demo_select)
self.cmd_entry = cmd_entry = tk.Entry(right)
cmd_entry.bind('<Return>', self.on_run)
run_btn = tk.Button(right, command=self.on_run, text='Run', width=8)
self.text = text = ScrolledText(right, font=('arial', 12, 'normal'), width = 30, wrap='word')
self.linker = linker = LinkManager(text, self.on_link)
self.text.tag_config("header1", font=('arial', 14, 'bold'))
self.text.tag_config("header2", font=('arial', 12, 'bold'))
text.config(state='disabled')
text.pack(fill='both', expand=1, side=tk.BOTTOM)
cmd_entry.pack(fill='x', side='left' , expand=1)
run_btn.pack()
示例9: __init__
# 需要导入模块: import Tkinter [as 别名]
# 或者: from Tkinter import VERTICAL [as 别名]
def __init__(self):
root = tk.Tk()
root.title('OpenCV Demo')
self.win = win = tk.PanedWindow(root, orient=tk.HORIZONTAL, sashrelief=tk.RAISED, sashwidth=4)
self.win.pack(fill=tk.BOTH, expand=1)
left = tk.Frame(win)
right = tk.Frame(win)
win.add(left)
win.add(right)
scrollbar = tk.Scrollbar(left, orient=tk.VERTICAL)
self.demos_lb = demos_lb = tk.Listbox(left, yscrollcommand=scrollbar.set)
scrollbar.config(command=demos_lb.yview)
scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
demos_lb.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
self.samples = {}
for fn in glob('*.py'):
name = splitfn(fn)[1]
if fn[0] != '_' and name not in exclude_list:
self.samples[name] = fn
for name in sorted(self.samples):
demos_lb.insert(tk.END, name)
demos_lb.bind('<<ListboxSelect>>', self.on_demo_select)
self.cmd_entry = cmd_entry = tk.Entry(right)
cmd_entry.bind('<Return>', self.on_run)
run_btn = tk.Button(right, command=self.on_run, text='Run', width=8)
self.text = text = ScrolledText(right, font=('arial', 12, 'normal'), width = 30, wrap='word')
self.linker = linker = LinkManager(text, self.on_link)
self.text.tag_config("header1", font=('arial', 14, 'bold'))
self.text.tag_config("header2", font=('arial', 12, 'bold'))
text.config(state='disabled')
text.pack(fill='both', expand=1, side=tk.BOTTOM)
cmd_entry.pack(fill='x', side='left' , expand=1)
run_btn.pack()