Suggestions wanted on Tkinter problem
norseman at hughes.net
Fri Apr 17 18:39:00 CEST 2009
Dave Angel wrote:
> norseman wrote:
>> <div class="moz-text-flowed" style="font-family: -moz-fixed">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.
>> 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(.....
>> At this point the program runs, but I cannot control gray-out of a
>> specific Radiobutton.
>> If I:
>> for mode, text ....
>> c[counter] = Radiobuton(specified_frame,..
>> 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?
> Try posting as text. The html tags in the message are distracting.
> I don't know tkinter, but I can see a problem with your code. You're
> using the  operators on c, but you never initialize c. Of course, you
> have a tiny fragment of code, and we're supposed to guess the rest. But
> normally, when you build a list, you start with:
> mylist = 
> for xxxx in yyyy:
> c = ....new widget....
> Now, c is just temporary, but mylist contains reference to all the
> widgets. So later on, you can use mylist to get button# 42.
> A separate problem is that mylist should be a member of a class derived
> from the frame widget, or something like that. So if this code is part
> of an __init__ method of a class, there are a few "self" items needed.
I don't use HTML! I re-checked the file I sent and it is plain text.
I have no idea where the file you received has been, but sorry for
problem because Yes, they are distracting from my own experiences.
"... if code is part of an __init__..." No. It's for Global control.
I have tried every combination I could dream up -- except the (now)
obvious one. Being too close to the problem is just that - too close.
Problem solved - Thank you very much.
More information about the Python-list