Iain Day wrote:

def edit_preferences(event=None):
    prefs = Preferences(master, title="Preferences")

class Preferences(tkSimpleDialog.Dialog):
    def body(self, master):
        settings = tk.LabelFrame(master, text="Settings")
        settings.grid(row=0, column=0)
tk.Label(settings, text="Angular Units: ").grid(row=0, column=0, sticky=tk.E)
        angles = tk.StringVar(value='radians')

          self.angles = angles # keep a reference to the variable

tk.Radiobutton(settings, text="Degrees", variable=angles,value='degrees').grid(row=0, column=1) tk.Radiobutton(settings, text="Radians", variable=angles,value='radians').grid(row=0, column=2)

Widgets don't keep references to their option values, so unless you explicitly keep a reference to the variable yourself (e.g. via an instance attribute, as above), it'll be removed at the end of the method.

</F>

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to