[Tkinter-discuss] A Hello and a Question

Olivier Feys olivier.feys at gmail.com
Wed May 3 14:41:44 CEST 2006


Here is a small example :

import Tkinter as tk
def change_frame(i,j):
   frames[i].pack_forget()
   frames[j].pack()

frames = []

r = tk.Tk()

#frames that you fill with your widgets
f1 = tk.Frame(r)
tk.Button(f1,command=lambda :change_frame(0,1),text='go to step 1').pack()

f2 = tk.Frame(r)
tk.Button(f2,command=lambda :change_frame(1,2),text='go to step 2').pack()

f3 = tk.Frame(r)
tk.Label(f3,text='step2').pack()


frames = [f1,f2,f3]

f1.pack()
r.mainloop()

Peter Lacroix wrote:

>Hello, I'm new to this list. I've come in search of some answers to 
>questions I hope I can articulate enough to be understood.
>
>I would like to know how one would create a button that when clicked would 
>clear the entire set of widgets (including the clicked button itself) and 
>then display a whole new set of widgets.
>
>The goal is to write a program that has about 6 different steps the user 
>goes through to submit information. So for instance the first frame would 
>welcome the user and display a "Click to Continue" button. When the button 
>is clicked, the widgets would all disappear and be replaced by a new set of 
>widgets. When these widgets are finsihed being used and the "Continue" or 
>"Submit" button is clicked, again a new set of widgets would replace the 
>old...and so on.
>
>I am lost as to how I would design a class(?) that would carry out such a 
>task. Ultimately, when the last set of widgets is finished, the program 
>would revert back to the first set of widgets.
>
>Is what I am asking clear? Any help would be appreciated.
>
>Peter.
>
>_________________________________________________________________
>FREE pop-up blocking with the new MSN Toolbar - get it now! 
>http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
>
>_______________________________________________
>Tkinter-discuss mailing list
>Tkinter-discuss at python.org
>http://mail.python.org/mailman/listinfo/tkinter-discuss
>
>  
>



More information about the Tkinter-discuss mailing list