Tkinter

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,470
Messages
2,571,807
Members
48,797
Latest member
PeterSimpson
Top