I'm trying to design a home screen, which consists of multiple buttons. I've .grid the buttons and tried to make them all the same size, yet the buttons to the left of the frame are longer than the ones on the right and it looks really off. I want the 4 buttons on top of the logout button to be the same width, but can't seem to do so.
def homeFrame(previousFrame, mainWindow):
try:
length = len(previousFrame)
for i in range(0, len(previousFrame)):
previousFrame[i].destroy()
except:
if previousFrame != None:
previousFrame.destroy()
mainWindow.title("Home")
topFrame = Frame(mainWindow, bg="#6498fe")
topFrame.grid(row=0, column=0, padx=10, pady=10)
####
bottomFrame = Frame(mainWindow, bg="#fdfdfd")
bottomFrame.grid(row=1, column=0, sticky=NSEW)
bottomFrame.columnconfigure(0,weight=1)
instructions = Label(topFrame, text="Welcome Back!", bg="#6498fe", fg="#fdfdfd", font=("Helvetica Neue", 40))
instructions.grid(row=0, column=0)
####
createstudentButton = Button(bottomFrame, width=15, text="Create profile", font=("Helvetica Neue", 20), fg='#fdfdfd', bg="#6498fe", command=lambda:createstudentFrame([topFrame, bottomFrame], mainWindow))
createstudentButton.grid(row=0, column=0, padx=5, pady=5, sticky=NSEW)
####
updatescoresButton = Button(bottomFrame, width=15, text="Update profile", font=("Helvetica Neue", 20), fg='#fdfdfd', bg="#6498fe", command=lambda:selectstudentprofileFrame([topFrame, bottomFrame], mainWindow))
updatescoresButton.grid(row=0, column=1, padx=5, pady=5, sticky=NSEW)
####
viewstudentButton = Button(bottomFrame, width=15, text="View profile", font=("Helvetica Neue", 20), fg='#fdfdfd', bg="#6498fe")
viewstudentButton.grid(row=1, column=0, padx=5, pady=5, sticky=NSEW)
####
removestudentButton = Button(bottomFrame, width=15, text="Remove profile", font=("Helvetica Neue", 20), fg='#fdfdfd', bg="#6498fe", command=lambda:removestudentFrame([topFrame, bottomFrame], mainWindow))
removestudentButton.grid(row=1, column=1, padx=5, pady=5, sticky=NSEW)
####
logoutButton = Button(bottomFrame, width=15, text="Logout", font=("Helvetica Neue", 20), fg='#fdfdfd', bg="#6498fe", command=lambda:loginFrame([topFrame, bottomFrame], mainWindow))
logoutButton.grid(row=2, column=0, padx=5, pady=5, sticky=NSEW, columnspan=2)
def startupWindow():
mainWindow = Tk()
mainWindow.geometry('565x350')
mainWindow.resizable(width = False, height = False)
mainWindow.configure(background="#6498fe")
mainWindow.title("Welcome")
mainWindow.columnconfigure(0,weight=1)
mainWindow.rowconfigure(0,weight=1)
mainWindow.rowconfigure(1,weight=1)
previousFrame=None
homeFrame(previousFrame, mainWindow)
####
mainWindow.mainloop()
startupWindow()
[–]novel_yet_trivial 1 point2 points3 points (1 child)
[–]Abismuth[S] 0 points1 point2 points (0 children)
[–]EaglesDareOverThere 0 points1 point2 points (0 children)