def __init__(self, parent, window, *args, **kwargs):
ttk.Treeview.__init__(self, parent, selectmode="browse", columns=["", ""], *args, **kwargs)
self.parent = window
self.heading("#0", text="Resource File")
self.heading("#1", text="Files")
self.column("#1", anchor="e", width=50, stretch=False)
self.heading("#2", text="File Extension")
self.column("#2", width=100, stretch=False)
self.widget_menu_tree = tk.Menu(self)
self.bind("<Button-3>", self.show_menu)
self.widget_menu_tree.add_command(label="Open", command=self.parent.open_file)
self.widget_menu_tree.add_command(label="Edit", state="disabled")
self.widget_menu_tree.add_separator()
self.widget_menu_tree.add_command(label="Delete", command=self.parent.cmd.tree_delete_selected)
python类Button()的实例源码
eval_gui.py 文件源码
项目:python-tagger
作者: Bilingual-Annotation-Task-Force
项目源码
文件源码
阅读 20
收藏 0
点赞 0
评论 0
def _create_widgets(self):
# Gold standard data
self.gold_path_label = ttk.Label(text="Gold Standard:")
self.gold_path_entry = ttk.Entry(textvariable=self.gold_path)
self.gold_path_filebutton = ttk.Button(text="...", command=self.findgoldfile)
# Training data for language 1
self.lang1_train_path_label = ttk.Label(text="Language 1 Training Data:")
self.lang1_train_path_entry = ttk.Entry(textvariable=self.lang1_train_path)
self.lang1_train_path_filebutton = ttk.Button(text="...", command=self.findlang1trainfile)
# Training data for language 2
self.lang2_train_path_label = ttk.Label(text="Language 2 Training Data:")
self.lang2_train_path_entry = ttk.Entry(textvariable=self.lang2_train_path)
self.lang2_train_path_filebutton = ttk.Button(text="...", command=self.findlang2trainfile)
# Examination
self.examine_button = ttk.Button(text="Examine!", command=self.launch_main)
# Redirected ouput
self.output_frame = ttk.Frame()
self.output = tk.Text(master=self.output_frame)
self.output_scroll = ttk.Scrollbar(self.output_frame)
self.output.configure(yscrollcommand=self.output_scroll.set)
self.output_scroll.configure(command=self.output.yview)
self.redirected = Redirector(self.output)
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", 60)]
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)
def onNewTask(self):
print("This Will Allow The User To Create An Task.")
self.taskWindows = Toplevel(self)
self.taskWindows.wm_title("New Task")
Label(self.taskWindows, text="Task Name").grid(row=0)
Label(self.taskWindows, text="Task Day:").grid(row=1)
Label(self.taskWindows, text="Task Month:").grid(row=2)
Label(self.taskWindows, text="Task Year:").grid(row=3)
self.taskGrid1 = Entry(self.taskWindows)
self.taskGrid2 = Entry(self.taskWindows)
self.taskGrid3 = Entry(self.taskWindows)
self.taskGrid4 = Entry(self.taskWindows)
self.taskGrid1.grid(row=0, column=1)
self.taskGrid2.grid(row=1, column=1)
self.taskGrid3.grid(row=2, column=1)
self.taskGrid4.grid(row=3, column=1)
Button(self.taskWindows, text='Add', command=self.taskWindowAdd).grid(row=5, column=0, sticky=W, pady=4)
Button(self.taskWindows, text='Cancel', command=self.taskWindowClose).grid(row=5, column=1, sticky=W, pady=4)
Embed_tkinter.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 19
收藏 0
点赞 0
评论 0
def tkinterApp():
import tkinter as tk
from tkinter import ttk
win = tk.Tk()
win.title("Python GUI")
aLabel = ttk.Label(win, text="A Label")
aLabel.grid(column=0, row=0)
ttk.Label(win, text="Enter a name:").grid(column=0, row=0)
name = tk.StringVar()
nameEntered = ttk.Entry(win, width=12, textvariable=name)
nameEntered.grid(column=0, row=1)
nameEntered.focus()
def buttonCallback():
action.configure(text='Hello ' + name.get())
action = ttk.Button(win, text="Print", command=buttonCallback)
action.grid(column=2, row=1)
win.mainloop()
#==================================================================
GUI_Complexity_end_tab3_multiple_notebooks.py 文件源码
项目:Python-GUI-Programming-Cookbook-Second-Edition
作者: PacktPublishing
项目源码
文件源码
阅读 23
收藏 0
点赞 0
评论 0
def display_tab3():
monty3 = ttk.LabelFrame(display_area, text=' New Features ')
monty3.grid(column=0, row=0, padx=8, pady=4)
# Adding more Feature Buttons
startRow = 4
for idx in range(24):
if idx < 2:
colIdx = idx
col = colIdx
else:
col += 1
if not idx % 3:
startRow += 1
col = 0
b = ttk.Button(monty3, text="Feature " + str(idx + 1))
b.grid(column=col, row=startRow)
# Add some space around each label
for child in monty3.winfo_children():
child.grid_configure(padx=8)
#------------------------------------------
def body(self, master):
TreeDialog.body(self, master)
frame = ttk.Frame(master)
frame.pack(side="right")
frame_one = ttk.Frame(frame)
frame_one.pack(pady=5)
add = ttk.Button(frame_one, text="Add Pack")
add.pack()
remove = ttk.Button(frame_one, text="Remove Pack")
remove.pack()
frame_two = ttk.Frame(frame)
frame_two.pack(pady=5)
enable = ttk.Button(frame_two, text="Enable Pack")
enable.pack()
disable = ttk.Button(frame_two, text="Disable Pack")
disable.pack()
def __init__(self, parent, title="", title_command=None, info="", info_command=None, background="SystemButtonFace", *args):
ttk.Frame.__init__(self, parent, *args)
self.parent = parent
self._title = title
self._title_command = title_command
self._info = info
self._info_command = info_command
self._background = background
self.columnconfigure(1, weight=1)
style = ttk.Style()
style.configure("InfoBar.Toolbutton", background=self._background)
style.configure("InfoClose.InfoBar.Toolbutton", anchor="center")
if self._title != "":
self._title_button = ttk.Button(self, text=self._title, style="InfoBar.Toolbutton", command=self._title_command)
self._title_button.grid(row=0, column=0)
self._info_button = ttk.Button(self, text=self._info, style="InfoBar.Toolbutton", command=self._info_command)
self._info_button.grid(row=0, column=1, sticky="we")
self._close_button = ttk.Button(self, text="x", width=2, style="InfoClose.InfoBar.Toolbutton", command=self.close)
self._close_button.grid(row=0, column=2)
def __init__(self, parent=None):
tk.Tk.__init__(self, parent)
self.parent = parent
self.log_text = tkst.ScrolledText(self, state=tk.DISABLED)
self.log_text.configure(font='TkFixedFont')
self.log_text.pack(side=tk.LEFT, padx=5, pady=5)
self.start_button = ttk.Button(parent, text='Start ConsoleMini', state=tk.NORMAL,
command=self.start_twitch_bits_info)
self.start_button.pack(side=tk.TOP, padx=12, pady=12)
self.stop_button = ttk.Button(parent, text='Stop ConsoleMini', state=tk.DISABLED,
command=self.stop_twitch_bits_info)
self.stop_button.pack(side=tk.TOP, padx=12, pady=12)
self.update_button = ttk.Button(parent, text='Manual update JSON', state=tk.DISABLED,
command=self.manual_update_json)
self.update_button.pack(side=tk.TOP, padx=12, pady=12)
def init_frame(self):
self.dbfile = ''
self.file_entry = ttk.Entry(self, width=25)
self.file_entry.grid(column=0, row=1, columnspan=2, sticky='W')
self.selecdb_button = ttk.Button(self, text='Browse',
command=self.select_file)
self.selecdb_button.grid(column=2, row=1, sticky='E')
self.usage_check = CheckButton(self)
self.usage_check.grid(column = 0, row = 2, sticky='E')
self.usage_label = ttk.Label(self, text='Load also usage sentences')
self.usage_label.grid(column = 1, row = 2, sticky='W')
self.load_button = ttk.Button(self, text='Load words',
command=self.load_words)
self.load_button.grid(column = 2, row = 2, sticky='W')
def init_frame(self):
ttk.Label(self, text='App id').grid(column=0, row=0)
self.appid_entry = ttk.Entry(self, width=30)
self.appid_entry.grid(column=1, row = 0)
ttk.Label(self, text='App key').grid(column=0, row=1)
self.keyid_entry = ttk.Entry(self, width=30)
self.keyid_entry.grid(column=1, row = 1)
self.load_button = ttk.Button(self, text='Load definitions from OED',
command=self.load_info)
self.load_button.grid(column=0, row=2, columnspan = 2, rowspan = 2)
# self.load_button.state(['disabled'])
try: # for lazines I store my OED credentials in a file
secrets = open('secrets')
self.appid_entry.insert(0, secrets.readline()[:-1])
self.keyid_entry.insert(0, secrets.readline()[:-1])
secrets.close()
except:
pass
def __init__(self, parent, *args, **kwargs):
GridFrame.__init__(self, parent, *args, **kwargs)
self.paused = True
self.steps = 0
self.go = False
self.playbutton = ttk.Button(self, text='Play', command=lambda : self.toggle())
self.add(self.playbutton, 0, 0)
self.stepbutton = ttk.Button(self, text='Step', command=lambda : self.step())
self.add(self.stepbutton, 1, 0)
self.entry = Entry(self)
self.add(self.entry, 0, 1, xspan=2)
self.gobutton = ttk.Button(self, text='Go', command=lambda : self.set_go())
self.add(self.gobutton, 0, 2, xspan=2)
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
label = tk.Label(self, text="Graph Page!", font=LARGE_FONT)
label.pack(pady=10,padx=10)
button1 = ttk.Button(self, text="Back to Home",
command=lambda: controller.show_frame(StartPage))
button1.pack()
canvas = FigureCanvasTkAgg(f, self)
canvas.show()
canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)
toolbar = NavigationToolbar2TkAgg(canvas, self)
toolbar.update()
canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
def __init__(self, master):
super().__init__()
self.master = master
self.title("Add new Language")
self.geometry("300x150")
self.name_label = ttk.Label(self, text="Language Name", anchor="center")
self.name_entry = ttk.Entry(self)
self.code_label = ttk.Label(self, text="Language Code", anchor="center")
self.code_entry = ttk.Entry(self)
self.submit_button = ttk.Button(self, text="Submit", command=self.submit)
self.name_label.pack(fill=tk.BOTH, expand=1)
self.name_entry.pack(fill=tk.BOTH)
self.code_label.pack(fill=tk.BOTH, expand=1)
self.code_entry.pack(fill=tk.BOTH, expand=1)
self.submit_button.pack(fill=tk.X)
def __init__(self, parent, *args, **kwargs):
tk.Toplevel.__init__(self, parent, *args, **kwargs)
self.parent = parent
self.resizable(False, False)
self.geometry("200x250")
self.transient(parent)
self.grab_set()
self.current_row = 0
self.frame_widget = ttk.Frame(self)
self.frame_widget.pack(fill="both", expand=True)
self.frame_widget.rowconfigure(0, weight=1)
self.frame_widget.columnconfigure(0, weight=1)
self.frame_buttons = ttk.Frame(self)
self.frame_buttons.pack(fill="x")
ttk.Button(self.frame_buttons, text="Close", command=self.close).pack(side="left")
self.parent.bind("<Configure>", self.center)
self.protocol("WM_DELETE_WINDOW", self.close)
self.center()
def insert_extending_text(self, what: str="", extend: str="", fill_line: bool=False, index: int or str="end", command=None, *args):
"""Inserts a string of text that can be extended."""
tag = "Extend-{}-{}:{}".format(re.sub("[^0-9a-zA-Z]+", "", extend), "normal", self.id_current_extend)
tag2 = "Extend-{}-{}:{}".format(re.sub("[^0-9a-zA-Z]+", "", extend), "extend", self.id_current_extend)
self.text.tag_configure(tag, foreground=self.colour_extend_on, elide=False)
self.text.tag_configure(tag2, foreground=self.colour_extend_off, elide=True)
self.text.insert(index, what + "\n" if fill_line else what, tag)
self.text.insert(index, extend + "\n" if fill_line else extend, tag2)
self.unbind_tag(tag, release=True, both=True)
self.text.tag_bind(tag, "<ButtonRelease-1>", command, "+")
self.text.tag_bind(tag, "<Button-1>", lambda *args: self.toggle_extend(tag, tag2), "+")
self.bind_cursor(tag)
self.bind_background(tag)
self.id_current_extend += 1
def insert_checkbutton(self, what: str="", variable: tk.BooleanVar=None, fill_line: bool=True, index: int or str="end", command=None, *args):
"""Insert a checkbutton into the game."""
tag = "Check-{}:{}".format(re.sub("[^0-9a-zA-Z]+", "", what), self.id_current_check)
if variable.get():
self.text.tag_configure(tag, foreground=self.colour_check_on)
elif not variable.get():
self.text.tag_configure(tag, foreground=self.colour_check_off)
self.text.insert(index, what + "\n" if fill_line else what, tag)
self.unbind_tag(tag)
self.text.tag_bind(tag, "<Button-1>", command, "+")
self.text.tag_bind(tag, "<Button-1>", lambda *args: self.toggle_check(variable, tag), "+")
self.bind_cursor(tag)
self.bind_background(tag)
self.id_current_check += 1
def insert_radiobutton(self, what: str="", variable: tk.IntVar=None, value: int=0, fill_line: bool=True, index: int or str="end", command=None, *args):
"""Inserts a radiobutton into the game."""
tag = "Radio-{}-{}:{}".format(re.sub("[^0-9a-zA-Z]+", "", str(variable)), str(value), self.id_current_radio)
if variable.get() == value:
self.text.tag_configure(tag, foreground=self.colour_radio_on)
elif variable.get() != value:
self.text.tag_configure(tag, foreground=self.colour_radio_off)
self.text.insert(index, what + "\n" if fill_line else what, tag)
self.unbind_tag(tag, release=True, both=True)
self.text.tag_bind(tag, "<ButtonRelease-1>", command, "+")
self.text.tag_bind(tag, "<Button-1>", lambda *args: self.toggle_radio(variable, value, tag), "+")
self.bind_cursor(tag)
self.bind_background(tag)
self.id_current_radio += 1
def insert_trigger(self, what: str="", fill_line: bool=False, index: int or str="end", command=None, *args):
"""Inserts a trigger into the game."""
tag = "Trigger-{}:{}".format(re.sub("[^0-9a-zA-Z]+", "", what), self.id_current_trigger)
self.text.tag_configure(tag, foreground=self.colour_trigger_on)
self.text.insert(index, what + "\n" if fill_line else what, tag)
self.unbind_tag(tag)
self.text.tag_bind(tag, "<Button-1>", command, "+")
self.text.tag_bind(tag, "<Button-1>", lambda *args: self.toggle_trigger(tag), "+")
self.bind_cursor(tag)
self.bind_background(tag)
self.id_current_trigger += 1
return tag
def __init__(self, master, *args, **kwargs):
super().__init__(master, *args, **kwargs)
self.title("Convert File")
self.master = master
self.file_opt = options = {}
options['defaultextension'] = '.txt'
options['filetypes'] = [('text files', '.txt')]
options['initialdir'] = "C:\\Users\\%s\\" % getpass.getuser()
options['parent'] = master
options['title'] = "Choose a file"
self.grid_columnconfigure(1, weight=1)
msg = Label(self, text="Convert tab delineated .txt to .xlsx.")
msg.grid(row=0, columnspan=3, pady=(10, 4), padx=5)
lab = Label(self, text="Text file: ")
lab.grid(row=1, column=0, padx=5)
# this stores the displayed version of the filename
self.v_display = StringVar()
b1 = ttk.Button(self, text="Browse...", command=self.askopenfilename)
b1.grid(row=1, column=1, padx=5)
self.geometry('190x80+300+300')
def button_from_label(self, text, image_url, cmd, status):
image = Image.open(image_url)
image = image.resize((30, 30), Image.ANTIALIAS)
photo = ImageTk.PhotoImage(image)
btn = Label(self,
text=text,
image=photo,
compound=TOP,
width=70,
bg=NOTEBOOK_COLOR,
cursor='hand2')
btn.bind('<Button-1>', cmd)
btn.bind('<Enter>', lambda e: (btn.config(bg='light cyan'),
self.controller.status_bar.set(status)))
btn.bind('<Leave>', lambda e:
(btn.config(bg=NOTEBOOK_COLOR),
self.controller.status_bar.set('Ready')))
btn.bind('<ButtonRelease-1>', lambda e: btn.config(bg='light cyan'))
return btn, photo
def __init__(self, master, **kwargs):
super().__init__(master, **kwargs)
self.content_frame = ttk.Frame(self)
self.lb_title = ttk.Label(self.content_frame, text='Lesson paused')
self.button_frame = ttk.Frame(self.content_frame)
self.bt_continue = ttk.Button(self.button_frame, text='Continue', default='active', command=self.on_continue)
self.bt_restart = ttk.Button(self.button_frame, text='Restart')
self.bt_abort = ttk.Button(self.button_frame, text='Abort')
self.content_frame.grid(column=0, row=0)
self.lb_title.grid(column=0, row=0, pady=3)
self.button_frame.grid(column=0, row=1, pady=10)
self.bt_continue.grid(column=0, row=1, pady=3)
self.bt_restart.grid(column=0, row=2, pady=3)
self.bt_abort.grid(column=0, row=3, pady=3)
self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=1)
self.focus_set()
def invalidInventoryPopup(self, msg, *mainFuncs):
"""
Creates a popupwindow and binds the button to multiple functions
:param msg: Text message displayed in the popupwindow
:type msg: str
:param mainFuncs: List of functions to be run when the user clicks OK
"""
window = Tk()
window.wm_title('Invalid Inventory File')
message = ttk.Label(window, text=msg)
message.grid(row=0, column=0, columnspan=2, pady=10, padx=10, sticky=tkinter.N + tkinter.S)
okButton = ttk.Button(window, text="OK", command=lambda: self.combine_funcs(window.destroy(), window.quit()))
okButton.grid(row=1, column=1, sticky=tkinter.N + tkinter.S)
window.mainloop()
def __init__(self,root,app):
ttk.Frame.__init__(self, root)
self.root=root
self.app=app
self.tool="select"
self.select=ttk.Button(master=self,text="Select",command=lambda:self.change_tool("select"))
self.horizontal=ttk.Button(master=self,text="Horizontal",command=lambda:self.change_tool("horizontal"))
self.hswitch=ttk.Button(master=self,text="HSwitch",command=lambda:self.change_tool("hswitch"))
self.delete=ttk.Button(master=self,text="Delete",command=lambda:self.change_tool("delete"))
self.flag=ttk.Button(master=self,text="Flag",command=lambda:self.change_tool("flag"))
self.auto=ttk.Button(master=self,text="Auto",command=lambda:self.change_tool("auto"))
self.select.grid(row=0,column=0)
self.auto.grid(row=0,column=1)
self.delete.grid(row=0,column=2)
self.horizontal.grid(row=0,column=3)
self.hswitch.grid(row=0,column=4)
self.flag.grid(row=0,column=5)
def __init__(self, controller):
super().__init__(controller, bg='white', width=1300, height=800)
self.controller = controller
self.node_id_to_node = {}
self.drag_item = None
self.start_position = [None]*2
self.start_pos_main_node = [None]*2
self.dict_start_position = {}
self.selected_nodes = set()
self.filepath = None
self.proj = 'Mercator'
self.ratio, self.offset = 1, (0, 0)
self.bind('<MouseWheel>', self.zoomer)
self.bind('<Button-4>', lambda e: self.zoomer(e, 1.3))
self.bind('<Button-5>', lambda e: self.zoomer(e, 0.7))
self.bind('<ButtonPress-3>', lambda e: self.scan_mark(e.x, e.y))
self.bind('<B3-Motion>', lambda e: self.scan_dragto(e.x, e.y, gain=1))
self.bind('<Enter>', self.drag_and_drop, add='+')
self.bind('<ButtonPress-1>', self.start_point_select_objects, add='+')
self.bind('<B1-Motion>', self.rectangle_drawing)
self.bind('<ButtonRelease-1>', self.end_point_select_nodes, add='+')
self.tag_bind('node', '<Button-1>', self.find_closest_node)
self.tag_bind('node', '<B1-Motion>', self.node_motion)
def setup_tab2(tab):
# new frame
new_frame = ttk.LabelFrame(tab, text='New Project Name')
new_frame.grid(columnspan=2, row=0, padx=5, pady=5, sticky='ew')
# New Project
name = tk.StringVar
name_entered = ttk.Entry(new_frame, width=19, textvariable=name)
name_entered.grid(column=0, row=0, padx=6, pady=5)
name_entered.focus()
# spacer
spacer_label = ttk.Label(new_frame, text='')
spacer_label.grid(columnspan=2, row=1, padx=5, pady=5)
# add button and commands
def add_command():
add_project(name_entered.get())
spacer_label.configure(text='Project was added!', foreground='green')
name_entered.delete(0, "end")
setup_tab1(TAB_1)
TAB_1.update()
add_button = ttk.Button(tab, text='Add New Project', command=add_command)
add_button.grid(columnspan=2, row=3, pady=5)
def _create_canvas(self, window):
# Configure canvas
canvas = Canvas(window)
hsb = ttk.Scrollbar(window, orient="h", command=canvas.xview)
vsb = ttk.Scrollbar(window, orient="v", command=canvas.yview)
canvas.configure(yscrollcommand=vsb.set, xscrollcommand=hsb.set)
canvas.grid(sticky="nsew")
hsb.grid(row=1, column=0, stick="ew")
vsb.grid(row=0, column=1, sticky="ns")
window.grid_rowconfigure(0, weight=1)
window.grid_columnconfigure(0, weight=1)
canvas.configure(scrollregion=(0, 0, 1250, 10000))
canvas.bind('<Configure>', lambda event,
canvas=canvas: self._resize_canvas(event, canvas))
canvas.bind_all("<Button-4>", lambda event, count=-1,
canvas=canvas: self._on_mousewheel(event, canvas, count))
canvas.bind_all("<Button-5>", lambda event, count=1,
canvas=canvas: self._on_mousewheel(event, canvas, count))
canvas.bind_all("<MouseWheel>", lambda event, count=1,
canvas=canvas: self._on_mousewheel(event, canvas, count))
return canvas
def __init__(self, app, master):
super().__init__(master, text="Effects/Samples - shift+click to assign sample", padding=4)
self.app = app
self.effects = {num: None for num in range(16)}
f = ttk.Frame(self)
self.buttons = []
for i in range(1, 9):
b = ttk.Button(f, text="# {:d}".format(i), width=14, state=tk.DISABLED)
b.bind("<ButtonRelease>", self.do_button_release)
b.effect_nr = i
b.pack(side=tk.LEFT)
self.buttons.append(b)
f.pack()
f = ttk.Frame(self)
for i in range(9, 17):
b = ttk.Button(f, text="# {:d}".format(i), width=14, state=tk.DISABLED)
b.bind("<ButtonRelease>", self.do_button_release)
b.effect_nr = i
b. pack(side=tk.LEFT)
self.buttons.append(b)
f.pack()
self.after(2000, lambda: Pyro4.Future(self.load_settings)(True))
def calenderStyleWidget(self):
style = ttk.Style(self.master)
styleArrowLayout = lambda dir: (
[('Button.focus', {'children': [('Button.%sarrow' % dir, None)]})]
)
style.layout('L.TButton', styleArrowLayout('left'))
style.layout('R.TButton', styleArrowLayout('right'))
style.configure('Calendar.Treeview', rowheight=40)
def calenderPlaceWidget(self):
#Header Frame
calenderFrame = ttk.Frame(self)
leftMonthChangeButton = ttk.Button(calenderFrame, style='L.TButton', command=self.setPreviousMonth)
rightMonthChangeButton = ttk.Button(calenderFrame, style='R.TButton', command=self.setNextMonth)
self.calenderHeader = ttk.Label(calenderFrame, width=15, anchor='center')
self.calenderMainView = ttk.Treeview(show='', selectmode='none', height=7, style='Calendar.Treeview')
#Pack Header
calenderFrame.pack(in_=self, side='top', pady=4, anchor='center')
leftMonthChangeButton.grid(in_=calenderFrame)
self.calenderHeader.grid(in_=calenderFrame, column=1, row=0, padx=12)
rightMonthChangeButton.grid(in_=calenderFrame, column=2, row=0)
self.calenderMainView.pack(in_=self, fill='x', side='top')