本文整理汇总了Python中tkinter.Y属性的典型用法代码示例。如果您正苦于以下问题:Python tkinter.Y属性的具体用法?Python tkinter.Y怎么用?Python tkinter.Y使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tkinter
的用法示例。
在下文中一共展示了tkinter.Y属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [as 别名]
def __init__(self):
super().__init__()
self.text_area = TextArea(self, bg="white", fg="black", undo=True)
self.scrollbar = ttk.Scrollbar(orient="vertical", command=self.scroll_text)
self.text_area.configure(yscrollcommand=self.scrollbar.set)
self.line_numbers = LineNumbers(self, self.text_area, bg="grey", fg="white", width=1)
self.highlighter = Highlighter(self.text_area, 'languages/python.yaml')
self.scrollbar.pack(side=tk.RIGHT, fill=tk.Y)
self.line_numbers.pack(side=tk.LEFT, fill=tk.Y)
self.text_area.pack(side=tk.LEFT, fill=tk.BOTH, expand=1)
self.bind_events()
示例2: show_friends
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [as 别名]
def show_friends(self):
self.configure(menu=self.menu)
self.login_frame.pack_forget()
self.canvas = tk.Canvas(self, bg="white")
self.canvas_frame = tk.Frame(self.canvas)
self.scrollbar = ttk.Scrollbar(self, orient="vertical", command=self.canvas.yview)
self.canvas.configure(yscrollcommand=self.scrollbar.set)
self.scrollbar.pack(side=tk.LEFT, fill=tk.Y)
self.canvas.pack(side=tk.LEFT, expand=1, fill=tk.BOTH)
self.friends_area = self.canvas.create_window((0, 0), window=self.canvas_frame, anchor="nw")
self.bind_events()
self.load_friends()
示例3: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [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)
示例4: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [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)
示例5: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [as 别名]
def __init__(self, master, initwidget, nmemb, orient=tk.HORIZONTAL, reverse=False, **kwargs):
assert callable(initwidget)
super().__init__(master, **kwargs)
self._interior = tk.Frame(self)
self.scroller = ScrollingUpdate(self,
initlist=[initwidget(master=self._interior) for i in range(nmemb)],
orient=orient,
reverse=reverse)
self.scrollbar = tk.Scrollbar(self, orient=orient)
if orient == tk.HORIZONTAL:
self.grid_columnconfigure(0, weight=1)
self._interior.grid(row=0, column=0, sticky="nswe")
self.scrollbar.grid(row=1, column=0, sticky="nswe")
elif orient == tk.VERTICAL:
self.grid_rowconfigure(0, weight=1)
self._interior.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
self.scrollbar.pack(side=tk.LEFT, fill=tk.Y)
self.orient = orient
示例6: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [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
示例7: run
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [as 别名]
def run(self):
root = tk.Tk()
self.root = root
root.title("Application Log")
text = tk.Text(root)
text.pack(side=tk.LEFT, fill=tk.BOTH, expand = tk.YES)
text.config(wrap=tk.WORD)
self.text = text
yscroll = tk.Scrollbar(command=text.yview)
text['yscrollcommand'] = yscroll.set
yscroll.pack(side=tk.RIGHT, fill=tk.Y)
text.config(state=tk.DISABLED)
self.update()
root.mainloop()
self.r_queue.put(("die", None))
# Q: OK. So you put Tkinter in it's own process.
# Now why is Pystray in another process too?!
# A: Because if I don't, MPV and GNOME Appindicator
# try to access the same resources and cause the
# entire application to segfault.
#
# I suppose this means I can put the Tkinter GUI back
# into the main process. This is true, but then the
# two need to be merged, which is non-trivial.
示例8: addMessageFrame
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [as 别名]
def addMessageFrame(self):
frame=Frame(self)
frame.pack(fill=tk.BOTH,side=tk.TOP,\
expand=1,padx=8,pady=5)
self.messagelabel=tk.Label(frame,text='Message',bg='#bbb')
self.messagelabel.pack(side=tk.TOP,fill=tk.X)
self.text=tk.Text(frame)
self.text.pack(side=tk.TOP,fill=tk.BOTH,expand=1)
self.text.height=10
scrollbar=tk.Scrollbar(self.text)
scrollbar.pack(side=tk.RIGHT,fill=tk.Y)
self.text.config(yscrollcommand=scrollbar.set)
scrollbar.config(command=self.text.yview)
示例9: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [as 别名]
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.title('Tk Chat')
self.geometry('700x500')
self.menu = tk.Menu(self, bg="lightgrey", fg="black", tearoff=0)
self.friends_menu = tk.Menu(self.menu, fg="black", bg="lightgrey", tearoff=0)
self.friends_menu.add_command(label="Add Friend", command=self.add_friend)
self.menu.add_cascade(label="Friends", menu=self.friends_menu)
self.configure(menu=self.menu)
self.canvas = tk.Canvas(self, bg="white")
self.canvas_frame = tk.Frame(self.canvas)
self.scrollbar = ttk.Scrollbar(self, orient="vertical", command=self.canvas.yview)
self.canvas.configure(yscrollcommand=self.scrollbar.set)
self.scrollbar.pack(side=tk.LEFT, fill=tk.Y)
self.canvas.pack(side=tk.LEFT, expand=1, fill=tk.BOTH)
self.friends_area = self.canvas.create_window((0, 0), window=self.canvas_frame, anchor="nw")
self.bind_events()
self.load_friends()
示例10: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [as 别名]
def __init__(self, master, **kwargs):
super().__init__(**kwargs)
self.master = master
self.transient(self.master)
self.geometry('500x250')
self.title('Choose font and size')
self.configure(bg=self.master.background)
self.font_list = tk.Listbox(self, exportselection=False)
self.available_fonts = sorted(families())
for family in self.available_fonts:
self.font_list.insert(tk.END, family)
current_selection_index = self.available_fonts.index(self.master.font_family)
if current_selection_index:
self.font_list.select_set(current_selection_index)
self.font_list.see(current_selection_index)
self.size_input = tk.Spinbox(self, from_=0, to=99, value=self.master.font_size)
self.save_button = ttk.Button(self, text="Save", style="editor.TButton", command=self.save)
self.save_button.pack(side=tk.BOTTOM, fill=tk.X, expand=1, padx=40)
self.font_list.pack(side=tk.LEFT, fill=tk.Y, expand=1)
self.size_input.pack(side=tk.BOTTOM, fill=tk.X, expand=1)
示例11: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [as 别名]
def __init__(self, win):
ttk.Frame.__init__(self, win)
frame_left = ttk.Frame(self)
frame_right1 = ttk.Frame(self)
frame_right2 = ttk.Frame(self)
win.title("车牌识别")
win.state("zoomed")
self.pack(fill=tk.BOTH, expand=tk.YES, padx="5", pady="5")
frame_left.pack(side=LEFT,expand=1,fill=BOTH)
frame_right1.pack(side=TOP,expand=1,fill=tk.Y)
frame_right2.pack(side=RIGHT,expand=0)
ttk.Label(frame_left, text='原图:').pack(anchor="nw")
ttk.Label(frame_right1, text='车牌位置:').grid(column=0, row=0, sticky=tk.W)
from_pic_ctl = ttk.Button(frame_right2, text="来自图片", width=20, command=self.from_pic)
from_vedio_ctl = ttk.Button(frame_right2, text="来自摄像头", width=20, command=self.from_vedio)
self.image_ctl = ttk.Label(frame_left)
self.image_ctl.pack(anchor="nw")
self.roi_ctl = ttk.Label(frame_right1)
self.roi_ctl.grid(column=0, row=1, sticky=tk.W)
ttk.Label(frame_right1, text='识别结果:').grid(column=0, row=2, sticky=tk.W)
self.r_ctl = ttk.Label(frame_right1, text="")
self.r_ctl.grid(column=0, row=3, sticky=tk.W)
self.color_ctl = ttk.Label(frame_right1, text="", width="20")
self.color_ctl.grid(column=0, row=4, sticky=tk.W)
from_vedio_ctl.pack(anchor="se", pady="5")
from_pic_ctl.pack(anchor="se", pady="5")
self.predictor = predict.CardPredictor()
self.predictor.train_svm()
示例12: __init__
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [as 别名]
def __init__(self, master=None):
super().__init__(master)
self.text = tk.Text(self, width=80, height=40)
self.vsb = tk.Scrollbar(self, command=self.text.yview)
self.text.pack(side=tk.LEFT, expand=True, fill=tk.BOTH)
self.vsb.pack(side=tk.RIGHT, expand=True, fill=tk.Y)
self.text.insert(tk.END, HELP_TXT)
self.text.config(state=tk.DISABLED, xscrollcommand=self.vsb.set)
示例13: pack
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [as 别名]
def pack(self):
self.file_selector_button.pack(**self.button_opt)
self.label.pack()
self.scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
self.selected_files.pack(fill=tkinter.BOTH, expand=True)
示例14: grid
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [as 别名]
def grid(self, row=0, column=0):
"""
TODO: to be tested
"""
x = row
y = column
self.file_selector_button.grid(row=x, column=y, **self.button_opt)
x += 1
self.label.grid(row=x, column=y)
x += 1
self.scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
self.selected_files.grid(row=x, column=y, fill=tkinter.BOTH, expand=True)
x += 1
return (x,y)
示例15: _get_groupframe
# 需要导入模块: import tkinter [as 别名]
# 或者: from tkinter import Y [as 别名]
def _get_groupframe(self, group):
if group not in self._groups:
if self._groups:
self._add_separator()
frame = tk.Frame(master=self, borderwidth=0)
frame.pack(side=tk.LEFT, fill=tk.Y)
self._groups[group] = frame
return self._groups[group]