Suggestions wanted on Tkinter problem

N

norseman

One suggested I change the subject line - OK
I also replaced the [TAB]s since I noticed the Emailer seems
to get very confused with them.



Problem:
Using Python 2.5.2 and Tkinter ??? (came with system)
List made and for loop in use
lst=[ ("S", "Single"), .....]

for mode, text ....
c = Radiobuton(.....
c.pack()

At this point the program runs, but I cannot control gray-out of a
specific Radiobutton.

If I:

counter=0
for mode, text ....
c[counter] = Radiobuton(specified_frame,..
c[counter].pack()
counter += 1
.
.
blockUseOf= $varSetElsewhere
c[blockUseOf].config(state = strSetElsewhere)

Program crashes on Radiobutton line.

There are a number of Frames containing Radiobuttons in the program.
The individual lists are long enough no one in their right mind wants to
hand code such repetition and then try to maintain it. Not even with a
code generator. (Number and organization will change over time.)
How do I set things to be able to control any given Radiobutton from
elsewhere in the program and still use the for-loop loader?


Steve
 
S

Steven D'Aprano

At this point the program runs, but I cannot control gray-out of a
specific Radiobutton.

If I:

counter=0
for mode, text ....
c[counter] = Radiobuton(specified_frame,..
c[counter].pack()
counter += 1
.
.
blockUseOf= $varSetElsewhere

What language are you programming in? $varSetElsewhere isn't legal Python.

c[blockUseOf].config(state = strSetElsewhere)

Program crashes on Radiobutton line.


No no, don't tell us *what* error you got! We LOVE guessing games!!!

Hmm, this guessing game might be harder than I like. Not only aren't we
told what the error is, but half of the line that contains the error is a
secret.

How about telling us what the actual error is, and the actual line that
causes the error? Chances are very good that the error message will tell
you everything you need to know about why the program fails.



There are a number of Frames containing Radiobuttons in the program. The
individual lists are long enough no one in their right mind wants to
hand code such repetition and then try to maintain it.

Then perhaps you should think about changing the user interface to make
it simpler to manage, and simpler to use. Not every task requires a
hammer.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,130
Latest member
MitchellTe
Top