I'm a beginner and I have recently started using the tkinter library.I have a proglem : I declared MainScreen in a function using global, but it says that the Name Mainscreen is not defined. Pls help.
import tkinter
from tkinter import *
start_screen = tkinter.Tk()
start_screen.title("Start screen")
start_screen.attributes('-fullscreen', True)
def stop_start():
start_screen.destroy()
global MainScreen
MainScreen = tkinter.Tk()
MainScreen.title("Main Screen")
MainScreen.attributes('-fullscreen', True)
Label(start_screen, text=' ', height=20).pack(side='top')
strt_btn = Button(start_screen, text="START", command=stop_start).pack(side='top')
def x_btn_root():
MainScreen.destroy()
LabelFrame(MainScreen, width=1280, bg='gray').grid(row=0, column=0)
Button(LabelFrame, text="X", highlightcolor='red', command=x_btn_root).pack(side='left')
start_screen.mainloop()