Newbie Radiobutton question (again)

Rick Olson r_olson at acusd.edu
Mon Jul 9 15:11:06 EDT 2001


I apologise for reposting this, but I originally posted through Google and
my post never appeared through my University news server, so I'm not sure
how wide the distribution was.  I also have a little more information.

I'm trying to run the following from IDLE:
from Tkinter import *
root=Tk()
x=IntVar()
x.set(2)
Radiobutton(root, text='a',value=1,variable=x).pack(anchor=W)
Radiobutton(root, text='b',value=2,variable=x).pack(anchor=W)

With Red Hat 7.1 (Python 1.5.2, IDLE .4) it runs fine the first time.  I get
the window and the second radio button is selected.  If I close the window
and try to run it again by  immediately clicking on F5 the window and
buttons appear, but nothing is selected.  If I click on the buttons they
work properly.  Even closing the window with the program, reopening the file
and running won't cause the buttons to be selected.  I need to close IDLE,
and restart IDLE. I was able to get IDLE .6 to run and have the same
problem.

With Win2K (Python 1.6.1, IDLE .6) it runs every time.

If I add a mainloop() to the end and run it from the command line  in linux
everything is fine.

Any suggestions?  I considered upgrading the Linux Python to 2.0 or 2.1, but
that didn't seem trivial and I don't know wheter I really need to do it.  If
I really need to install Python 2.0 could someone point to a site with
*detailed* instructions.  The download page instructions '...do the usual
"gunzip; tar; configure; make" dance.' are over my head.  (I'd ask more
specific questions about how to do it if I knew more)

Thanks in advance--
Rick Olson





More information about the Python-list mailing list