tags:

views:

196

answers:

1

I want to add a new feature in a wxPython class. I also want the existing functionality as it is plus new functionality. What is the best way to achieve the target? It would be great if someone can tell a step by step procedure?

I am newbie to wxPython, and writing my first application in wxPython.

Also, what is the difference between native control and full owner-drawn control.

+3  A: 

Welcome to wxPython! If you want create something custom, you'll want to sub-class the base control you want to modify. Often times this will be a wx.Panel if you are combining multiple things, but it can also be a radio button, checkbox, et cetera. Check out http://wiki.wxpython.org/CreatingCustomControls which explains it in great detail with examples.

A native control defers to the operating system for drawing. A native checkbox basically says "hey OS, draw a checkbox for me", so it will look how it should, "native" on any system, including blending in with the theme. An owner-drawn checkbox is drawn by custom code, that will often look the same across all systems. This offers a lot more flexibility in how your control looks and behaves but comes at the cost of a native look and feel, and will often not play well with accessibility.

These two concepts are not particularly correlated though; just because a control is custom does not mean it has to be owner drawn, nor is a built-in wxPython control always native.

If you download the wxPython demo app you can find all sorts of examples of native, owner-drawn, and custom controls. Hope this helps!

mrooney
Great answer, extra thanks for clarifying the "just because a control is custom does not mean it has to be owner drawn" part, that was my doubt.
Hugo