On 08/08/06, wesley chun <[EMAIL PROTECTED]> wrote:
> import Tkinter
>
> root = Tkinter.Tk()
> MyButton = partial(Tkinter.Button, root, fg='white', bg='blue')
> b1 = MyButton(text='Button 1')
> b2 = MyButton(text='Button 2')
> qb = MyButton(text='QUIT', bg='red', command=root.quit)
>
> "MyButton" c
> Also you can put more information in your data structure if you want
> (eg, information on placing the button, styles for the button, etc).
> And, if you need to save the Button objects themselves, you could add
> them to a dict in the body of the loop:
>
> self.buttons = {}
> for label, callback
On 08/08/06, Alan Gauld <[EMAIL PROTECTED]> wrote:
> Why not just add the buttons to a list as you create them then
> iterate over the list? Or better still use a dictionary with the name
> as key.
You can do nice things with tuples.
A simple example would be:
# (label, callback)
buttons = [('OK
>I need to scan a long list of QT tickboxes in a dialog. I need to
>execute
> pseudo code something like ...
>
> list = ['error_button', 'print_button' ... etc ]
> for key in list:
> button= list[key]
> print button, self.button.isChecked()
>
>
> where self.button.isChecked() becomes self.error
Thanks for all your input - the discussion wandered off list a bit !
This solution works a treat ...
button= getattr(self, 'error_button')
print button, button.isChecked()
Cheers
Dave
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mail
> > list = ['error_button', 'print_button' ... etc ]
> > for key in list:
> > button= list[key]
> > print button, self.button.isChecked()
> >
> list = ['error_button', 'print_button' ... etc ]
> for key in list:
>
On Mon, 2006-08-07 at 18:10 +, dave s wrote:
> I need to scan a long list of QT tickboxes in a dialog. I need to execute
> pseudo code something like ...
>
>
> list = ['error_button', 'print_button' ... etc ]
> for key in list:
> button= l