L
Luke
Hello, I'm an inexperienced programmer and I'm trying to make a
Tkinter window and have so far been unsuccessful in being able to
delete widgets from the main window and then add new ones back into
the window without closing the main window.
The coding looks similar to this:
from Tkinter import *
def MainWin():
main=Tk()
main.geometry('640x480')
back_ground=Frame(main,width=640,height=480,bg='black')
back_ground.pack_propagate(0)
back_ground.pack(side=TOP,anchor=N)
frame1=Frame(back_ground,width=213,height=480,bg='light gray')
frame1.pack_propagate(0)
frame1.pack(side=TOP,anchor=N)
close_frame1=Button(frame1,text='close',bg='light gray',
command=frame1.destroy)
close_frame1.pack_propagate(0)
close_frame1.pack(side=TOP, anchor=N,pady=25)
if frame1.destroy==True:
frame1=Frame(back_ground,width=213,height=480,bg='white')
frame1.pack_propagate(0)
frame1.pack(side=TOP,anchor=N)
main.mainloop()
MainWin()
It may just be bad coding but either way I could use some help.
Thanks
Tkinter window and have so far been unsuccessful in being able to
delete widgets from the main window and then add new ones back into
the window without closing the main window.
The coding looks similar to this:
from Tkinter import *
def MainWin():
main=Tk()
main.geometry('640x480')
back_ground=Frame(main,width=640,height=480,bg='black')
back_ground.pack_propagate(0)
back_ground.pack(side=TOP,anchor=N)
frame1=Frame(back_ground,width=213,height=480,bg='light gray')
frame1.pack_propagate(0)
frame1.pack(side=TOP,anchor=N)
close_frame1=Button(frame1,text='close',bg='light gray',
command=frame1.destroy)
close_frame1.pack_propagate(0)
close_frame1.pack(side=TOP, anchor=N,pady=25)
if frame1.destroy==True:
frame1=Frame(back_ground,width=213,height=480,bg='white')
frame1.pack_propagate(0)
frame1.pack(side=TOP,anchor=N)
main.mainloop()
MainWin()
It may just be bad coding but either way I could use some help.
Thanks