GenToggleButton enabling issue

Hi,

I’m writing a toy Tic-Tac-Toe game using the generic buttons portion of wxPython. Specifically, I’m using the GenToggleButton. For some reason, when I disable the set of buttons and then re-enable them, the vast majority of the buttons remain disabled. The ones that are enabled appear to be in the first row or so of buttons.

I am attaching the code. I’m on Windows 7, Python 2.7 with wxPython 2.9.4.0 msw (classic)

main.py (3.13 KB)

···

Mike Driscoll

Blog: http://blog.pythonlibrary.org

Mike Driscoll wrote:

Hi,

I'm writing a toy Tic-Tac-Toe game using the generic buttons portion of
wxPython. Specifically, I'm using the GenToggleButton. For some reason,
when I disable the set of buttons and then re-enable them, the vast
majority of the buttons remain disabled. The ones that are enabled
appear to be in the first row or so of buttons.

I am attaching the code. I'm on Windows 7, Python 2.7 with wxPython
2.9.4.0 msw (classic)

Because in onToggle you are always disabling everything except for the button that was just toggled, and then when it reaches the button that was toggled it enables all, but then continues through the list disabling everything else, and that happens both when a button transitions to or from the toggled state.

···

--
Robin Dunn
Software Craftsman

Hi Robin,

···

On Saturday, July 27, 2013 1:45:15 PM UTC-5, Robin Dunn wrote:

Mike Driscoll wrote:

Hi,

I’m writing a toy Tic-Tac-Toe game using the generic buttons portion of

wxPython. Specifically, I’m using the GenToggleButton. For some reason,

when I disable the set of buttons and then re-enable them, the vast

majority of the buttons remain disabled. The ones that are enabled

appear to be in the first row or so of buttons.

I am attaching the code. I’m on Windows 7, Python 2.7 with wxPython

2.9.4.0 msw (classic)

Because in onToggle you are always disabling everything except for the
button that was just toggled, and then when it reaches the button that
was toggled it enables all, but then continues through the list
disabling everything else, and that happens both when a button
transitions to or from the toggled state.


Robin Dunn

Software Craftsman

http://wxPython.org

Yup…I was blind. Thanks for the help!

Mike