本文整理汇总了Python中tkinter.VERTICAL属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.VERTICAL属性的具体用法?Python tkinter.VERTICAL怎么用?Python tkinter.VERTICAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.VERTICAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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, master=None, compound=tk.RIGHT, autohidescrollbar=True, **kwargs):
"""
Create a Listbox with a vertical scrollbar.
:param master: master widget
:type master: widget
:param compound: side for the Scrollbar to be on (:obj:`tk.LEFT` or :obj:`tk.RIGHT`)
:type compound: str
:param autohidescrollbar: whether to use an :class:`~ttkwidgets.AutoHideScrollbar` or a :class:`ttk.Scrollbar`
:type autohidescrollbar: bool
:param kwargs: keyword arguments passed on to the :class:`tk.Listbox` initializer
"""
ttk.Frame.__init__(self, master)
self.columnconfigure(1, weight=1)
self.rowconfigure(0, weight=1)
self.listbox = tk.Listbox(self, **kwargs)
if autohidescrollbar:
self.scrollbar = AutoHideScrollbar(self, orient=tk.VERTICAL, command=self.listbox.yview)
else:
self.scrollbar = ttk.Scrollbar(self, orient=tk.VERTICAL, command=self.listbox.yview)
self.config_listbox(yscrollcommand=self.scrollbar.set)
if compound is not tk.LEFT and compound is not tk.RIGHT:
raise ValueError("Invalid compound value passed: {0}".format(compound))
self.__compound = compound
self._grid_widgets()
示例4: configure
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import VERTICAL [as 别名]
def configure(self, cnf={}, **kwargs):
"""Update options of the TimeLine widget"""
kwargs.update(cnf)
TimeLine.check_kwargs(kwargs)
scrollbars = 'autohidescrollbars' in kwargs
for option in self.options:
attribute = "_" + option
setattr(self, attribute, kwargs.pop(option, getattr(self, attribute)))
if scrollbars:
self._scrollbar_timeline.destroy()
self._scrollbar_vertical.destroy()
if self._autohidescrollbars:
self._scrollbar_timeline = AutoHideScrollbar(self, command=self._set_scroll, orient=tk.HORIZONTAL)
self._scrollbar_vertical = AutoHideScrollbar(self, command=self._set_scroll_v, orient=tk.VERTICAL)
else:
self._scrollbar_timeline = ttk.Scrollbar(self, command=self._set_scroll, orient=tk.HORIZONTAL)
self._scrollbar_vertical = ttk.Scrollbar(self, command=self._set_scroll_v, orient=tk.VERTICAL)
self._canvas_scroll.config(xscrollcommand=self._scrollbar_timeline.set,
yscrollcommand=self._scrollbar_vertical.set)
self._canvas_categories.config(yscrollcommand=self._scrollbar_vertical.set)
self._scrollbar_timeline.grid(column=1, row=2, padx=(0, 5), pady=(0, 5), sticky="we")
self._scrollbar_vertical.grid(column=2, row=0, pady=5, padx=(0, 5), sticky="ns")
ttk.Frame.configure(self, **kwargs)
self.draw_timeline()
示例5: __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)
示例6: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import VERTICAL [as 别名]
def __init__(self, master=None, initlist=None, orient=tk.HORIZONTAL, reverse=False):
super().__init__(initlist)
self.offset = 0
self.show = 5 if initlist is None else len(initlist)
self.last_list_len = None
self._reverse = reverse
if reverse:
self.skip = -1
else:
self.skip = 1
if orient == tk.HORIZONTAL:
master.bind_all("<KP_Left>", self.inc_offset if reverse else self.dec_offset)
master.bind_all("<KP_Right>", self.dec_offset if reverse else self.inc_offset)
elif orient == tk.VERTICAL:
master.bind_all("<KP_Up>", self.inc_offset if reverse else self.dec_offset)
master.bind_all("<KP_Down>", self.dec_offset if reverse else self.inc_offset)
else:
raise ValueError
self.orient = orient
示例7: grid_inner
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import VERTICAL [as 别名]
def grid_inner(self, **kwargs):
if self.orient == tk.HORIZONTAL:
self._interior.grid_rowconfigure(0, weight=1)
for i, widget in enumerate(self.scroller):
self._interior.grid_columnconfigure(i, weight=1)
widget.grid(row=0, column=i, **kwargs)
if self.scroller._reverse:
self._interior.grid_columnconfigure(len(self.scroller)-1, weight=0)
else:
self._interior.grid_columnconfigure(0, weight=0)
elif self.orient == tk.VERTICAL:
self._interior.grid_columnconfigure(0, weight=1)
for i, widget in enumerate(self.scroller):
self._interior.grid_rowconfigure(i, weight=2)
widget.grid(row=i, column=0, **kwargs)
# widgets that are first must fully expand
if self.scroller._reverse:
self._interior.grid_rowconfigure(len(self.scroller)-1, weight=0)
else:
self._interior.grid_rowconfigure(0, weight=0)
示例8: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import VERTICAL [as 别名]
def __init__(self, parent, **kwargs):
super().__init__(parent, highlightthickness=0, **kwargs)
vscrollbar = tk.Scrollbar(self, orient=tk.VERTICAL)
vscrollbar.pack(side=tk.RIGHT, fill=tk.Y)
self.canvas = canvas = tk.Canvas(self, bd=2, highlightthickness=0,
yscrollcommand=vscrollbar.set)
canvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
vscrollbar.config(command=canvas.yview)
canvas.xview_moveto(0)
canvas.yview_moveto(0)
self.interior = interior = tk.Frame(canvas)
self.interior_id = canvas.create_window(0, 0,
window=interior,
anchor=tk.NW)
self.interior.bind("<Configure>", self.configure_interior)
self.canvas.bind("<Configure>", self.configure_canvas)
self.scrollbar = vscrollbar
self.mouse_position = 0
示例9: iniciaTabPL
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import VERTICAL [as 别名]
def iniciaTabPL(self):
ttk.Label(self.tabPL, text="Videos disponibles: ",
font=("Arial", 14)).place(x=5,y=10)
self.listPL = Listbox(self.tabPL, height=10, width=66,
font=("Arial", 14), bg='#ABAAAA')
scrollbar = ttk.Scrollbar(self.tabPL,
command=self.listPL.yview, orient=VERTICAL)
self.listPL.config(yscrollcommand=scrollbar.set)
self.listPL.config(selectforeground="#eeeeee",
selectbackground="#89C2DE",
selectborderwidth=1)
self.listPL.place(x=6,y=50)
scrollbar.place(x=723,y=50, height=254)
self.plbvideo = ttk.Button(self.tabPL, text="Ir a descargar video",
command = self.controlador.cargarInfoDesdePL)
self.plbvideo.place(x=30, y=320)
self.plbbvideo = ttk.Button(self.tabPL, text="Descargar playlist video")
self.plbbvideo.place(x=250, y=320)
self.plbbaudio = ttk.Button(self.tabPL, text="Descargar playlist audio")
self.plbbaudio.place(x=500, y=320)
示例10: __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)
示例11: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import VERTICAL [as 别名]
def __init__(self, master):
super().__init__(master, text="Levels", padding=4)
self.lowest_level = Player.levelmeter_lowest
self.pbvar_left = tk.IntVar()
self.pbvar_right = tk.IntVar()
pbstyle = ttk.Style()
# pbstyle.theme_use("classic") # clam, alt, default, classic
pbstyle.configure("green.Vertical.TProgressbar", troughcolor="gray", background="light green")
pbstyle.configure("yellow.Vertical.TProgressbar", troughcolor="gray", background="yellow")
pbstyle.configure("red.Vertical.TProgressbar", troughcolor="gray", background="orange")
ttk.Label(self, text="dB").pack(side=tkinter.TOP)
frame = ttk.LabelFrame(self, text="L.")
frame.pack(side=tk.LEFT)
self.pb_left = ttk.Progressbar(frame, orient=tk.VERTICAL, length=200, maximum=-self.lowest_level,
variable=self.pbvar_left, mode='determinate',
style='yellow.Vertical.TProgressbar')
self.pb_left.pack()
frame = ttk.LabelFrame(self, text="R.")
frame.pack(side=tk.LEFT)
self.pb_right = ttk.Progressbar(frame, orient=tk.VERTICAL, length=200, maximum=-self.lowest_level,
variable=self.pbvar_right, mode='determinate',
style='yellow.Vertical.TProgressbar')
self.pb_right.pack()
示例12: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import VERTICAL [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, "+")
示例13: _init_widgets
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import VERTICAL [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")
示例14: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import VERTICAL [as 别名]
def __init__(self, path):
super().__init__()
self.title("Ttk Treeview")
columns = ("#1", "#2", "#3")
self.tree = ttk.Treeview(self, show="headings", columns=columns)
self.tree.heading("#1", text="Last name")
self.tree.heading("#2", text="First name")
self.tree.heading("#3", text="Email")
ysb = ttk.Scrollbar(self, orient=tk.VERTICAL, command=self.tree.yview)
self.tree.configure(yscroll=ysb.set)
with open("contacts.csv", newline="") as f:
for contact in csv.reader(f):
self.tree.insert("", tk.END, values=contact)
self.tree.bind("<<TreeviewSelect>>", self.print_selection)
self.tree.grid(row=0, column=0)
ysb.grid(row=0, column=1, sticky=tk.N + tk.S)
self.rowconfigure(0, weight=1)
self.columnconfigure(0, weight=1)
示例15: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import VERTICAL [as 别名]
def __init__(self, path):
super().__init__()
self.title("Ttk Treeview")
abspath = os.path.abspath(path)
self.nodes = {}
self.tree = ttk.Treeview(self)
self.tree.heading("#0", text=abspath, anchor=tk.W)
ysb = ttk.Scrollbar(self, orient=tk.VERTICAL,
command=self.tree.yview)
xsb = ttk.Scrollbar(self, orient=tk.HORIZONTAL,
command=self.tree.xview)
self.tree.configure(yscroll=ysb.set, xscroll=xsb.set)
self.tree.grid(row=0, column=0, sticky=tk.N + tk.S + tk.E + tk.W)
ysb.grid(row=0, column=1, sticky=tk.N + tk.S)
xsb.grid(row=1, column=0, sticky=tk.E + tk.W)
self.rowconfigure(0, weight=1)
self.columnconfigure(0, weight=1)
self.tree.bind("<<TreeviewOpen>>", self.open_node)
self.populate_node("", abspath)