Jul-21-2018, 04:20 PM
Hello,
Trying to learn tkinter, by "doing." I could just write a script, or use many or endless backup applications, so ignore that =) Focus on the layout please.
My main issue is removing the space at the bottom of the "innerwindows" Canvas. I have two elements inside there, but can't figure out how to eliminate the space between the 2 labelFrames, and the buttons section. Any help or any other tips would be greatly appreciated.
Trying to learn tkinter, by "doing." I could just write a script, or use many or endless backup applications, so ignore that =) Focus on the layout please.
My main issue is removing the space at the bottom of the "innerwindows" Canvas. I have two elements inside there, but can't figure out how to eliminate the space between the 2 labelFrames, and the buttons section. Any help or any other tips would be greatly appreciated.
from tkinter import *
root = Tk()
#setting a minimum size
mainFrame = Frame(root, root.minsize(612, 715))
mainFrame.grid(row=0, column=0)
#set main title
root.title("Backup Utility")
#--------------- program functions-------------------------
# quit program
# select a source (include path)
# select a destination (include path)
# execute backup
# display "About information"
def doNothing():
#eventually will put something useful here
print("Ok ok, I won't...")
#---------------- File menu and it's items ----------------
menu = Menu(root)
root.config(menu=menu)
subMenu = Menu(menu)
menu.add_cascade(label="File", menu=subMenu)
subMenu.add_command(label="Open File", command=doNothing)
subMenu.add_command(label="Close", command=doNothing)
#create "separator"
subMenu.add_separator()
subMenu.add_command(label="Exit", command=exit)
editMenu = Menu(menu)
menu.add_cascade(label="Edit", menu=editMenu)
editMenu.add_command(label="Redo", command=doNothing)
helpMenu = Menu(menu)
menu.add_cascade(label="Help", menu=helpMenu)
helpMenu.add_command(label="About", command=doNothing)
# create a canvas to hold the "top and bottom" frames
#inner primary windows
innerwindows = LabelFrame(root, bd=3)
innerwindows.grid(row=0, column=0, rowspan=2, columnspan=2)
#--------------------Top canvas/Source UI -----------------------
top_canvas = LabelFrame(innerwindows, text="SOURCES: ", bd=3, relief=RIDGE)
top_canvas.grid(row=0, column=0, rowspan=2, columnspan=4, sticky="n", padx=20, pady=10, ipadx=200, ipady=40)
top_canvas_inner = Frame(top_canvas, bd=1, relief=GROOVE)
top_canvas_inner.grid(row=0, padx=12, pady=8)
#make these into input variable(4 max)
result1 = Label(top_canvas_inner, text="blah blah text here")
result1.grid(row=0, column=0, padx=4, pady=4)
result2 = Label(top_canvas_inner, text="ho ho ho")
result2.grid(row=1, column=0, padx=4, pady=4)
result3 = Label(top_canvas_inner, text="heh hehe hee")
result3.grid(row=2, column=0, padx=4, pady=4)
result4 = Label(top_canvas_inner, text="boo")
result4.grid(row=3, column=0, padx=4, pady=4)
#--------------- Bottom canvas/Destination UI ------------------
bottom_canvas = LabelFrame(innerwindows, text="DESTINATION: ", bd=3, relief=RIDGE)
bottom_canvas.grid(row=0, column=0, rowspan=2, columnspan=4, sticky="n", padx=20, pady=250, ipadx=200, ipady=40)
bottom_canvas_inner = Frame(bottom_canvas, bd=1, relief=GROOVE)
bottom_canvas_inner.grid(row=0, padx=12, pady=8)
result1 = Label(bottom_canvas_inner, text="blah blah text here")
result1.grid(row=0, column=0, padx=4, pady=4)
#---------------- Program Buttons section ----------------------
button_canvas = LabelFrame(innerwindows)
#button_portion = Label(button_canvas, text="Buttons here.")
#button_portion.pack(fill="both", expand=True)
button_canvas.grid(row=1, column=0, columnspan=4, sticky="s", padx=10, pady=10)
button1 = Button(button_canvas, text="Select Source", font="Times", width=12, relief=RAISED, bd=2)
button1.grid(row=2, column=0, padx=10, pady=10)
button2 = Button(button_canvas, text="Destination", font="Times", width=12, relief=RAISED, bd=2)
button2.grid(row=2, column=1, padx=10, pady=10)
button3 = Button(button_canvas, text="Backup File(s)", font="Times", width=12, relief=RAISED, bd=2)
button3.grid(row=2, column=2, padx=10, pady=10)
button4 = Button(button_canvas, text="Quit", font="Times", width=12, relief=RAISED, bd=2)
button4.grid(row=2, column=3, padx=10, pady=10)
#-------------------- Status bar ------------------------------
status_frame = Frame(root)
status = Label(status_frame, text="Preparing for backup..", bd=1, relief=SUNKEN, anchor=W)
status.pack(fill="both", expand=True)
status_frame.grid(row=3, column=0, columnspan=4, sticky="ew")
root.grid_rowconfigure(1, weight=1)
root.grid_columnconfigure(1, weight=1)
root.mainloop()
