[wxPython-users] [ANN] PlateButton Control for wxPython

Jorgen Bodde jorgen.maillist at gmail.com
Sat Dec 15 00:58:35 PST 2007


Hi Robin,

Thanks I will see if I can whip up something that can be used as a
base for custom controls once I get my app released.

Regards,
- Jorgen

On Dec 15, 2007 6:05 AM, Robin Dunn <robin at alldunn.com> wrote:
> Jorgen Bodde wrote:
> > Robin,
> >
> > This is more  a question to you. Is there like a standard "template"
> > for creating such a custom control? A lot of these pitfalls could be
> > omitted if there is let's say a best in class example of how the
> > custom control (derived from wx.PyControl) could work with most
> > methods filled in or at leasty documented that they need to be filled
> > in.
>
> I gave this list in one of my OSCON talks, I think it is still mostly
> accurate:
>
> 1. Derive from wx.PyControl. This enables reflection of some pertinent
> C++ virtual methods to Python methods in the derived class.
>
> 2. Call SetInitialSize from the __init__ method, passing the size
> passed to __init__. This helps set things up properly for sizers, and
> also sets the size of the control appropriately (using either the size
> given or the best size.)
>
> 3. Call InheritAttributes from the __init__ method. If the parent has
> non-standard font or colors then it will set them for your control.
>
> 4. Implement a DoGetBestSize method, returning the wx.Size that would
> best fit your control based on current font, label or other content, etc.
>
> 5. Implement an AcceptsFocus method, returning True if the control is
> meant to receive the keyboard focus.
>
>
> http://wxpython.org/OSCON2004/advanced/wxPython-Advanced-OSCON2004.pdf,
> slide 114.
>
> --
>
> Robin Dunn
> Software Craftsman
> http://wxPython.org  Java give you jitters?  Relax with wxPython!
>
> ---------------------------------------------------------------------
> 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