Tkinter

Discussion in 'Python' started by Luke, Feb 4, 2009.

  1. Luke

    Luke Guest

    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
    Luke, Feb 4, 2009
    #1
    1. Advertising

  2. Luke

    Luke Guest

    Thanks, Its working smoothly now
    Luke, Feb 5, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff Epler
    Replies:
    0
    Views:
    506
    Jeff Epler
    Aug 20, 2004
  2. Jeff Epler
    Replies:
    0
    Views:
    452
    Jeff Epler
    Aug 23, 2004
  3. Pierre Dagenais
    Replies:
    0
    Views:
    309
    Pierre Dagenais
    Aug 3, 2008
  4. Hidekazu IWAKI
    Replies:
    1
    Views:
    376
    Peter Otten
    Dec 14, 2009
  5. Hidekazu IWAKI
    Replies:
    0
    Views:
    523
    Hidekazu IWAKI
    Dec 15, 2009
Loading...

Share This Page