Just took me a half-hour to track this little gotcha down. The widget
browser in the toolbox shows the example code for a CheckBox to be the
following declaration:
for_widget = CheckBox(name="your_checkbox", attrs=dict(checked=True),
help_text="Just click me...")
This is misleading because it made me believe I could do the following
to uncheck the box:
for_widget = CheckBox(name="your_checkbox",
attrs=dict(checked=False), help_text="Just click me...")
This doesn't work, the box is still checked. Instead, it is merely the
existence of "checked" in the attrs dictionary which controls whether
it is checked. So the following is needed:
default = #whether the box should be checked
if default:
attrs = dict(checked=True)
else:
attrs = {}
for_widget = CheckBox(name="your_checkbox", attrs=attrs,
help_text="Just click me...")
I would suggest allowing the default option to be used in the
following way:
for_widget = CheckBox(name="your_checkbox", default=[[True or
False]], help_text="Just click me...")
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---