[wxPython-users] Read Only wx.CheckBox

Cody Precord codyprecord at gmail.com
Sun Nov 4 14:03:42 PST 2007


Hello,

You need to do more than just trap the event, you need to reset the  
value in the handler as well.

def OnCheck(self, evt):
	e_obj = evt.GetEventObject()
	e_obj.SetValue(not e_obj.GetValue())


cody

On Nov 4, 2007, at 2:24 PM, Mark Erbaugh wrote:

> On Sat, 2007-11-03 at 23:06 -0500, Cody Precord wrote:
>> No I don' t think so, but you can bind to EVT_CHECKBOX and prevent
>> the check box from changing its value in the event handler to get
>> this behavior.
>
> It doesn't look like trapping and not propagating the EVT_CHECKBOX has
> any effect. I did have some success by trapping both EVT_LEFT_DOWN  
> (for
> a mouse click) and EVT_KEY_DOWN (and for hitting the space bar with  
> the
> checkbox focuesd) events.  However, if the checkbox is set up to  
> respond
> to an accelerator key press (i.e. Alt-I  as in &Inactive), that still
> causes the state of the checkbox to change.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users- 
> help at lists.wxwidgets.org
>





More information about the wxpython-users mailing list