Radio-button in Tkinter

ns56645 ns56645 at swt.edu
Sun Apr 23 06:48:22 CEST 2000


In the following code the radiobuttons that have been set are not seen
as default selected in the output.
For e.g         v1.set(3) # initialize should set the radiobutton with
text 'BOTH' as default.


What could be the wrong with the code?
Please help?

Shah


#######        Frame 3  Radio Buttons
##########################################################

        # Create the "Location" contents of the page.
        group = Pmw.Group(frame3, tag_text = 'Location')
        group.pack(fill = 'both', expand = 1, padx = 15, pady = 10)

        v1 = IntVar()
        v1.set(3) # initialize
        rb1 = Radiobutton(group.interior(), text = 'SWT', variable=v1,
value=1)
        rb1.grid(row = 0, column = 0)
        rb2 = Radiobutton(group.interior(), text = 'WHS', variable=v1,
value=2)
        rb2.grid(row = 0, column = 1)
        rb3 = Radiobutton(group.interior(), text = 'BOTH', variable=v1,
value=3)
        rb3.grid(row = 0, column = 2)


        # Create the "Level" contents of the page.
        group = Pmw.Group(frame3, tag_text = 'Level')
        group.pack(fill = 'both', expand = 1, padx = 15, pady = 10)

        v2 = IntVar()
        v2.set("13") # initialize
        rb11 = Radiobutton(group.interior(), text = 'Grad', variable=v2,
value=11)
        rb11.grid(row = 0, column = 0)
        rb12 = Radiobutton(group.interior(), text = 'UnderGrad',
variable=v2, value=12)
        rb12.grid(row = 0, column = 1)
        rb13 = Radiobutton(group.interior(), text = 'BOTH', variable=v2,
value=13)
        rb13.grid(row = 0, column = 2)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20000422/ec19e573/attachment.html>


More information about the Python-list mailing list