[wxPython-users] GridCellChoiceEditor

Frank Millman frank at chagford.com
Wed Feb 6 00:01:29 PST 2008


Mark Erbaugh wrote:
> 
> How would you get a reference to the actual widget?  It looks 
> like it is created in the C++ code (m_control), but it 
> doesn't seem to be available in Python.  I've worked out some 
> convoluted code using the OnEditorShown and OnEditorCreated 
> events, but that seems awkward.
> 

I am guessing here, but thanks to Robin, (I would never have figured it out
by myself), I use the following code to get a reference to the underlying
checkbox in a GridCellBoolEditor -

    def onEditorCreated(self,evt):
        self.checkbox = evt.GetControl()

or if you prefer (which I do) -

    def onEditorCreated(self,evt):
        self.checkbox = evt.Control

A few releases ago Robin made most object attributes directly accessible,
instead of having to use the Get/Set methods, and I always make use of this
when I can.

HTH

Frank Millman





More information about the wxpython-users mailing list