Checkbox Options

I’ve attached a script where I would like to do following but not getting there:

1] Get checked options under ‘OnApply’

2] Once I checked few options then ‘Select’ or ‘UnSelectAll’ will only not select/unselect those options which were not selected/selected manually?

Do I need to index all check box options to do above tasks?

Any help to accomplish this would be very appreciative. Please let me know if its not clear.

wx_test_checkbox.py (4.65 KB)

I've attached a script where I would like to do following but not getting
there:

You're creating lots of checkboxes, but they all have the same name
(self.cb) and you're not tracking their states individually. Also,
creating and setting their values individually makes for lots of duplicated
code.

The simplest way to quickly set up stuff like this is with a list, as I've
done to your example. Lists keep their contents in order; the first item
has an index of 0 and the last one (your "Send output to file" checkbox)
has an index of -1. If you want to keep track of anything more
complicated, you can store your checkboxes in a dictionary instead.

1] Get checked options under 'OnApply'

I created a list called "selection", and populated it with the values of
your checkboxes. I don't know what you want to do with it afterward...

2] Once I checked few options then 'Select' or 'UnSelectAll' will only not
select/unselect those options which were not selected/selected manually?

Standard two-state checkboxes don't "know" how they got their current
state; if you want to keep track of state (True/False) and ALSO how it got
that way (whether the user clicked it, or it got set/unset via a button),
you'll need to use a 3-state checkbox, or store the meta-state separately
(here's where a dictionary, or maybe a dictionary of dictionaries, could
come in handy.)

Do I need to index all check box options to do above tasks?

Yup.

Hope that helped...

wx_test_checkbox.py (2.59 KB)

···

On Mon, Jul 8, 2013 at 5:22 PM, Ibraheem Khan <ibraheem.khan99@gmail.com>wrote:

Thanks, Marc. It will help alot.

···

On Monday, July 8, 2013 8:22:52 PM UTC-4, Ibraheem Khan wrote:

I’ve attached a script where I would like to do following but not getting there:

1] Get checked options under ‘OnApply’

2] Once I checked few options then ‘Select’ or ‘UnSelectAll’ will only not select/unselect those options which were not selected/selected manually?

Do I need to index all check box options to do above tasks?

Any help to accomplish this would be very appreciative. Please let me know if its not clear.