By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,428 Members | 1,340 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,428 IT Pros & Developers. It's quick & easy.

a list of Checkbuttons

P: n/a
OK I'm tired, I've got a cold, and my brain isn't working very well. I
have a result set ( a tuple of tuples) from a db. Each element has two
elements; classification number, and classification heading. i.e.
result=((001,'heading one'),(002,'heading two'),...)

classification numbers may not be in numerical order, and may skip
numbers, so they are not good as an index.

I want to create tkinter Checkbuttons that allow me to select which
apply to the record I'm editing. What comes to my sub-par mind is to
create a list and assign Checkbuttons to each element. something like:

classifications = []
for count, classification in enumerate(result):
classifications.append( (IntVar(),classification[0]) )
text=str(classification[0])+': '+classification[1] ,

then to collect which boxes are checked:

for check in classifications:
if check[0].get() == 1:
print 'classification number %s selected" % check[1][0]
Is this the smartest way to do this? It should work, but will I be able
to understand this 6 months from now?


Aug 29 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.