I am learning basics of tinker in python 3.x using PyCharm as an IDE.I am building a basic two window program where 'Customer choice' window should be called after clicking CustomerButton in Welcome Window. Welcome window has two buttons- customer and staff. customer choice window has two buttons- order and cancel order. For some reason, a blank 'Customer choice' window appears instead of the intended one.
from tkinter import *
print("aa")
def customerwindow():
root1 = Tk()
root1.title("Customer Choice")
window_width = 1000
window_height = 600
screen_height = root1.winfo_screenheight()
screen_width = root1.winfo_screenwidth()
x_coordinate = (screen_width / 2) - (window_width / 2)
y_coordinate = (screen_height / 2) - (window_height / 2)
root1.geometry('%dx%d+%d+%d' % (window_width, window_height, x_coordinate, y_coordinate))
frame1 = Frame(root1, height=1000, width=600)
frame1.pack(fill=BOTH)
Order = PhotoImage(file="fast-food.png")
Cancel = PhotoImage(file="delete.png")
OrderButton = Button(frame1, image=Order)
OrderButton.place(x=152, y=125)
CancelButton = Button(frame1, image=Cancel)
CancelButton.place(x=550, y=125)
OrderLabel = Label(frame1, text=" ORDER", font=("Poiret One", 24), fg='#34495E')
CancelLabel = Label(frame1, text=" CANCEL ORDER", font=("Poiret One", 24), fg='#34495E')
OrderLabel.place(x=152, y=405)
CancelLabel.place(x=550, y=405)
mainloop()
print("bb")
def welcomeWindow():
root = Tk()
root.title("Welcome")
window_width = 1000
window_height = 600
screen_height = root.winfo_screenheight()
screen_width = root.winfo_screenwidth()
x_coordinate = (screen_width/2) - (window_width/2)
y_coordinate = (screen_height/2) - (window_height/2)
root.geometry('%dx%d+%d+%d' % (window_width, window_height, x_coordinate, y_coordinate))
frame1 = Frame(root, height=1000, width=600)
frame1.pack(fill=BOTH)
customerPhoto = PhotoImage(file="boy.png")
staffPhoto = PhotoImage(file="boss.png")
customerButton = Button(frame1, image=customerPhoto, command=customerwindow)
customerButton.place(x=152, y=125)
staffButton = Button(frame1, image=staffPhoto)
staffButton.place(x=550, y=125)
customerLabel = Label(frame1, text=" CUSTOMER", font=("Poiret One", 24), fg='#34495E')
staffLabel = Label(frame1, text=" STAFF", font=("Poiret One", 24), fg='#34495E')
customerLabel.place(x=152, y=405)
staffLabel.place(x=550, y=405)
mainloop()
welcomeWindow()
print("SS")
#aa,bb,ss are just to check the interpreters progress.