Selecting an 8 x 8 grid of check boxes (or similar widgets)

I want to create an 8 x 8 grid of Check Boxes (Toggle Buttons would
work also).

I can easily provide the typical "Select/De-Select All" button,
however there my be times
when the user only wants to select >1 and < 64 of the widgets.

I was thinking that a Click-drag-select motion with the mouse would be
useful for this.
The user would click in the upper left corner, and drag to the lower
right corner, then release the mouse.

When the mouse is released, any widget within that rectangle would
change to the Selected state.

I don't know how to implement this though.

Has anyone done anything like this- or can point me to an example
which shows which events I need to handle?

···

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Hi,

I want to create an 8 x 8 grid of Check Boxes (Toggle Buttons would
work also).

I can easily provide the typical "Select/De-Select All" button,
however there my be times
when the user only wants to select >1 and < 64 of the widgets.

I was thinking that a Click-drag-select motion with the mouse would be
useful for this.
The user would click in the upper left corner, and drag to the lower
right corner, then release the mouse.

When the mouse is released, any widget within that rectangle would
change to the Selected state.

I don't know how to implement this though.

Has anyone done anything like this- or can point me to an example
which shows which events I need to handle?

One thing you might try is (warning: No Mac Allowed):

- Use wx.ScreenDC to draw a rubberband rectangle (there should be a
demo in the wxPython demo folders);
- Get the screen rectangle from the rubberband (i.e., screenRect);
- Loop through all your checkboxes:

for check in checkBoxes:
    if screeenRect.ContainsRect(check.GetScreenRect()):
        check.SetValue(1)
    else:
        check.SetValue(0)

Or something around these lines.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

==> Never *EVER* use RemovalGroup for your house removal. You'll
regret it forever.
The Doomed City: Removal Group: the nightmare <==

···

On 28 April 2010 18:36, cappy2112 wrote:

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

That sounds reasonable.
I've found rubberband.py. I'll give it a try.

Thanks!

···

On Apr 28, 2:24 pm, Andrea Gavana <andrea.gav...@gmail.com> wrote:

Hi,

One thing you might try is (warning: No Mac Allowed):

- Use wx.ScreenDC to draw a rubberband rectangle (there should be a
demo in the wxPython demo folders);
- Get the screen rectangle from the rubberband (i.e., screenRect);
- Loop through all your checkboxes:

for check in checkBoxes:
if screeenRect.ContainsRect(check.GetScreenRect()):
check.SetValue(1)
else:
check.SetValue(0)

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en