wxpython documentation

127 views
Skip to first unread message

Fidel Sanchez-Bueno

unread,
Aug 13, 2010, 3:28:37 AM8/13/10
to wxPytho...@googlegroups.com
Hello..

Where can i find a documentation that shows the methods of all the
wxpython widgets??


recently I was looking for a method to change the choices of a
wx.choice, and the wxWigets doc page was the first result on google, but
the method was "Set()" and it gave me an error..

After a minute googling I found this post [1] and clear my doubt (in
python the method is "SetItems()")

I know that google and patience can clear my doubts, but if theres any
documentation about the widgets methods it will be better

PS: the guy that anwser in the post of the link, says that the HTML
documentation of wxpython shows that, but I didnt find it :S. If the doc
is this one [2] it actually didnt show the methods of wx.choice

[1] http://www.manning-sandbox.com/thread.jspa?threadID=23650&tstart=45
[2] http://www.wxpython.org/docs/api/wx.Choice-class.html

Gadge...@live.co.uk

unread,
Aug 13, 2010, 5:09:52 AM8/13/10
to wxpytho...@googlegroups.com

--------------------------------------------------
From: "Fidel Sanchez-Bueno" <fidel...@gmail.com>
Sent: Friday, August 13, 2010 8:28 AM
To: <wxPytho...@googlegroups.com>
Subject: [wxPython-users] wxpython documentation

> Hello..
>
> Where can i find a documentation that shows the methods of all the
> wxpython widgets??
>
>
> recently I was looking for a method to change the choices of a wx.choice,
> and the wxWigets doc page was the first result on google, but the method
> was "Set()" and it gave me an error..
>
> After a minute googling I found this post [1] and clear my doubt (in
> python the method is "SetItems()")
>
> I know that google and patience can clear my doubts, but if theres any
> documentation about the widgets methods it will be better
>
> PS: the guy that anwser in the post of the link, says that the HTML
> documentation of wxpython shows that, but I didnt find it :S. If the doc
> is this one [2] it actually didnt show the methods of wx.choice

There are 2 possible ways for you to access the information:
(1) The wxWidgets documentation that you can download as a part of the Docs
and Demos package at
http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-docs-demos-2.8.11.0.exe -
just remember three things when using it - a) wx.Choice will be found as
wxChoice, b) Always look at the end of the method description for any python
specific notes & c) if what you need is not documented there then look at
the class(es) that the widget is derived from and the 'See also' section.

(2) Open a python shell and use the dir and help commands for the object,
e.g. if you type:
import wx
C=wx.Choice
dir(C)
you get:
['AcceleratorTable', 'AcceptsFocus', 'AcceptsFocusFromKeyboard', 'AddChild',
'Ad
dPendingEvent', 'AdjustForLayoutDirection', 'Alignment', 'Append',
'AppendItems'
, 'AssociateHandle', 'AutoLayout', 'BackgroundColour', 'BackgroundStyle',
'BestS
ize', 'BestVirtualSize', 'Bind', 'Border', 'CacheBestSize',
'CanSetTransparent',
'CaptureMouse', 'Caret', 'Center', 'CenterOnParent', 'Centre',
'CentreOnParent'
, 'CharHeight', 'CharWidth', 'Children', 'ClassName', 'Clear',
'ClearBackground'
, 'ClientAreaOrigin', 'ClientRect', 'ClientSize', 'ClientToScreen',
'ClientToScr
eenXY', 'ClientToWindowSize', 'Close', 'Command', 'Connect', 'Constraints',
'Con
tainingSizer', 'ConvertDialogPointToPixels', 'ConvertDialogSizeToPixels',
'Conve
rtPixelPointToDialog', 'ConvertPixelSizeToDialog', 'Count', 'Create',
'CurrentSe
lection', 'Cursor', 'DLG_PNT', 'DLG_SZE', 'DefaultAttributes', 'Delete',
'Destro
y', 'DestroyChildren', 'Disable', 'Disconnect', 'DissociateHandle',
'DragAcceptF
iles', 'DropTarget', 'EffectiveMinSize', 'Enable', 'Enabled',
'EventHandler', 'E
vtHandlerEnabled', 'ExtraStyle', 'FindFocus', 'FindString',
'FindWindowById', 'F
indWindowByLabel', 'FindWindowByName', 'Fit', 'FitInside', 'Font',
'ForegroundCo
lour', 'Freeze', 'GetAcceleratorTable', 'GetAdjustedBestSize',
'GetAlignment', '
GetAutoLayout', 'GetBackgroundColour', 'GetBackgroundStyle',
'GetBestFittingSize
', 'GetBestSize', 'GetBestSizeTuple', 'GetBestVirtualSize', 'GetBorder',
'GetCap
ture', 'GetCaret', 'GetCharHeight', 'GetCharWidth', 'GetChildren',
'GetClassDefa
ultAttributes', 'GetClassName', 'GetClientAreaOrigin', 'GetClientData',
'GetClie
ntRect', 'GetClientSize', 'GetClientSizeTuple', 'GetConstraints',
'GetContaining
Sizer', 'GetCount', 'GetCurrentSelection', 'GetCursor',
'GetDefaultAttributes',
'GetDropTarget', 'GetEffectiveMinSize', 'GetEventHandler',
'GetEvtHandlerEnabled
', 'GetExtraStyle', 'GetFont', 'GetForegroundColour', 'GetFullTextExtent',
'GetG
randParent', 'GetGtkWidget', 'GetHandle', 'GetHelpText',
'GetHelpTextAtPoint', '
GetId', 'GetItems', 'GetLabel', 'GetLabelText', 'GetLayoutDirection',
'GetMaxHei
ght', 'GetMaxSize', 'GetMaxWidth', 'GetMinHeight', 'GetMinSize',
'GetMinWidth',
'GetName', 'GetNextHandler', 'GetParent', 'GetPosition', 'GetPositionTuple',
'Ge
tPreviousHandler', 'GetRect', 'GetScreenPosition', 'GetScreenPositionTuple',
'Ge
tScreenRect', 'GetScrollPos', 'GetScrollRange', 'GetScrollThumb',
'GetSelection'
, 'GetSize', 'GetSizeTuple', 'GetSizer', 'GetString', 'GetStringSelection',
'Get
Strings', 'GetTextExtent', 'GetThemeEnabled', 'GetToolTip',
'GetTopLevelParent',
'GetUpdateClientRect', 'GetUpdateRegion', 'GetValidator', 'GetVirtualSize',
'Ge
tVirtualSizeTuple', 'GetWindowBorderSize', 'GetWindowStyle',
'GetWindowStyleFlag
', 'GetWindowVariant', 'GrandParent', 'GtkWidget', 'Handle', 'HasCapture',
'HasF
lag', 'HasMultiplePages', 'HasScrollbar', 'HasTransparentBackground',
'HelpText'
, 'Hide', 'HitTest', 'HitTestXY', 'Id', 'InheritAttributes',
'InheritsBackground
Colour', 'InitDialog', 'Insert', 'InvalidateBestSize', 'IsBeingDeleted',
'IsDoub
leBuffered', 'IsEmpty', 'IsEnabled', 'IsExposed', 'IsExposedPoint',
'IsExposedRe
ct', 'IsFrozen', 'IsRetained', 'IsSameAs', 'IsShown', 'IsShownOnScreen',
'IsTopL
evel', 'Items', 'Label', 'LabelText', 'Layout', 'LayoutDirection',
'LineDown', '
LineUp', 'Lower', 'MakeModal', 'MaxHeight', 'MaxSize', 'MaxWidth',
'MinHeight',
'MinSize', 'MinWidth', 'Move', 'MoveAfterInTabOrder',
'MoveBeforeInTabOrder', 'M
oveXY', 'Name', 'Navigate', 'NewControlId', 'NextControlId', 'NextHandler',
'OnP
aint', 'PageDown', 'PageUp', 'Parent', 'PopEventHandler', 'PopupMenu',
'PopupMen
uXY', 'Position', 'PostCreate', 'PrepareDC', 'PrevControlId',
'PreviousHandler',
'ProcessEvent', 'ProcessPendingEvents', 'PushEventHandler', 'Raise',
'Rect', 'R
efresh', 'RefreshRect', 'RegisterHotKey', 'ReleaseMouse', 'RemoveChild',
'Remove
EventHandler', 'Reparent', 'ScreenPosition', 'ScreenRect', 'ScreenToClient',
'Sc
reenToClientXY', 'ScrollLines', 'ScrollPages', 'ScrollWindow', 'Select',
'Select
ion', 'SendSizeEvent', 'SetAcceleratorTable', 'SetAutoLayout',
'SetBackgroundCol
our', 'SetBackgroundStyle', 'SetBestFittingSize', 'SetCaret',
'SetClientData', '
SetClientRect', 'SetClientSize', 'SetClientSizeWH', 'SetConstraints',
'SetContai
ningSizer', 'SetCursor', 'SetDimensions', 'SetDoubleBuffered',
'SetDropTarget',
'SetEventHandler', 'SetEvtHandlerEnabled', 'SetExtraStyle', 'SetFocus',
'SetFocu
sFromKbd', 'SetFont', 'SetForegroundColour', 'SetHelpText',
'SetHelpTextForId',
'SetId', 'SetInitialSize', 'SetItems', 'SetLabel', 'SetLayoutDirection',
'SetMax
Size', 'SetMinSize', 'SetName', 'SetNextHandler', 'SetOwnBackgroundColour',
'Set
OwnFont', 'SetOwnForegroundColour', 'SetPosition', 'SetPreviousHandler',
'SetRec
t', 'SetScrollPos', 'SetScrollbar', 'SetSelection', 'SetSize',
'SetSizeHints', '
SetSizeHintsSz', 'SetSizeWH', 'SetSizer', 'SetSizerAndFit', 'SetString',
'SetStr
ingSelection', 'SetThemeEnabled', 'SetToolTip', 'SetToolTipString',
'SetTranspar
ent', 'SetValidator', 'SetVirtualSize', 'SetVirtualSizeHints',
'SetVirtualSizeHi
ntsSz', 'SetVirtualSizeWH', 'SetWindowStyle', 'SetWindowStyleFlag',
'SetWindowVa
riant', 'ShouldInheritColours', 'Show', 'Shown', 'Size', 'Sizer',
'StringSelecti
on', 'Strings', 'Thaw', 'ThemeEnabled', 'ToggleWindowStyle', 'ToolTip',
'TopLeve
l', 'TopLevelParent', 'TransferDataFromWindow', 'TransferDataToWindow',
'Unbind'
, 'UnregisterHotKey', 'Update', 'UpdateClientRect', 'UpdateRegion',
'UpdateWindo
wUI', 'UseBgCol', 'Validate', 'Validator', 'VirtualSize', 'WarpPointer',
'Window
Style', 'WindowStyleFlag', 'WindowToClientSize', 'WindowVariant',
'__class__', '
__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__',
'__hash__
', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__',
'__repr__
', '__setattr__', '__sizeof__', '__str__', '__subclasshook__',
'__weakref__', '_
setOORInfo', 'thisown']

Then if you type:
help(C.SetItems)
You get:
Help on method SetItems in module wx._core:

SetItems(self, items) unbound wx._controls.Choice method
Clear and set the strings in the control from a list

Hope that helps.

Steve

> --
> To unsubscribe, send email to wxPython-user...@googlegroups.com
> or visit http://groups.google.com/group/wxPython-users?hl=en
>

Oswaldo Hernández

unread,
Aug 13, 2010, 5:31:00 AM8/13/10
to wxpytho...@googlegroups.com
El 13/08/2010 9:28, Fidel Sanchez-Bueno escribi�:

> Hello..
>
> Where can i find a documentation that shows the methods of all the
> wxpython widgets??
>

The docs at www.wxpython.org/docs/api shows only then widget specific
methods, but you must know that a widget class inherits all methods and
properties from his ancestors.

SetItems() is inherited from wx.ItemContainer class. On top of [2] is
showed all the ancestors or wx.Choice.

> [2] http://www.wxpython.org/docs/api/wx.Choice-class.html
>

Regards.

--
Oswaldo Hern�ndez

Fidel Sanchez-Bueno

unread,
Aug 13, 2010, 4:56:38 PM8/13/10
to wxpytho...@googlegroups.com
Thank @Steve and @oswaldo..

now am more clear about the documentation!...

Ray Pasco

unread,
Aug 13, 2010, 5:50:30 PM8/13/10
to Wxpython Users
Re: "wxpython documentation" @ http://groups.google.com/group/wxpython-users/browse_thread/thread/4a75056eacd8c579  on 2010-08-12

Fidel,
You certainly are not alone getting endlessly frustrated trying to find some the most basic information about using particular wx methods. There is no free complete and single source for wx documentation.

Here are some readily available partial documentation and working example sources (listed in no particular order):

1 - http://www.wxpython.org/docs/api/    You can browse this site directly, but I prefer to use Google to do a general search like you did because Google always lists this site in the first or second listed hit. The most effective Google search phrase template (for me) is:

    wxpython "wx.choice"

Use the quotes as shown. Just replace the word [ choice ] with the wx control_name or wx constant_name of your choosing. The [ wx. ] part is very necessary to search for *all* relevant web pages..

2 - The "wxPython Docs Demos and Tools". These are 2 separate downloads and installations from the wxPython package. There are very many working examples in the single all-inclusive demo program. Every "built-in" and many "pure wxPython" controls have working demos. However, detailed method explanations are very few and far between. The example code is very easily viewed and copied. Getting any one control demo sample to run as a stand-alone app is a real PITA. The wxPython demo program and the HTML doc packages are available in the same web page as the wxPython download:    wxPython2 Docs Demos and Tools

3 - The WxWidgets C++ documentation. Most of this has been already regenerated into wxPython documentation, but there are sometimes extra usable information here.

4 - Searching all the [ .py ] files for the usage of the control in which you are interested. On Win7 (and Vista ?) platforms, Microsoft, in their infinite wisdom, has eliminated the Windows XP text string search capability in the Windows Explorer file search utility. However, I found a truly great 3rd part search utility over 11 years ago that was developed in the NT days and still works as extremely efficiently as it originally did. I have researched literally 100 other search/search+replace apps and they all have serious, if not fatal, deficiencies that make them completely useless. My life-saving utility is called Search & Replace by Funduc Software. It has been updated for Vista and Win7 but it appears and operates identically to the original release.

    If you are reasonably proficient using regular expressions (I'm not) you can perform complex searches and search+replaces using egrep regex phrase searches instead of the default plain text searches. This program is literally "worth its weight in gold" to me and is extraordinarily fast.  (No, I don't get any "cut" from its sales. It costs only USD $25) It's offered in 32-bit and 64-bit versions for MSW, but I've never encountered any working 32-bit MSW program that didn't work on a MSW 64-bit platform. 32-bit MSW programs run properly on each of the 2 MSW platforms for XP, Vista and Win7.

5 - Organize you own collection of Python and wxPython sample apps then use Search&Replace to locate sample usages of the control or parameter you are researching. I've been collecting working samples and adding explanation comments for years and this source is extremely useful to me. This takes lots of time and effort, but this is well worth it to me. I also "play around" with them by temporarily altering the code to see the differences.

6 - ActiveState.com Code Recipes.  Lots of useful wxPython and Python working examples are free-for-the-taking. ActiveState wxPython and Python are commercial packages that are NOT open source. However, it seems to have all the standard Python interpreters and many add-on packages for all the wxPython and Python versions. I guess that their customers buy them mostly for their documentation. I wouldn't know. I use these 8 methods to figure out what I need to know. You can always ask right here if you get really stuck or want to know something obscure (or just not documented).

7 - www.daniweb.com - There's lots of good working examples here.

8 - Right Here !    I first do all my own research homework. Whatever useful info turns up I file into my accumulated research, item 5, because I do not have a photographic memory.


Other Things That You Should Be Aware (or "Beware" ?!):

- Finding parameter names and parameter constant values and their documentation is unnecessarily difficult.  You can sometimes find them listed in the actual wxPython code implementation buried within your Python/wxPython ../site-packages/... folder.

- Over half my library of sample apps have NOT come from the wxPython-users discussion board or the wxPython.org sites. They have been posted from many other discussion boards. These sites are mostly *nix platform developers' discussion forums. I'm amazed that the vast majority of the apps work properly on Windows platforms. They will show up on Google searches.

Happy Hunting  (I mean this literally)
Ray Pasco

Fidel Sanchez-Bueno

unread,
Aug 13, 2010, 5:52:49 PM8/13/10
to wxpytho...@googlegroups.com
thanks!!...

these are all very good tips!, thanks for the help..

the one you miss was the one that steve told in a couple of mail back, about using the "dir" function to search all the methods of a wxpython specific widget!..

I found that one very good..

thanks again for the tips! and the help!..

C M

unread,
Aug 13, 2010, 8:06:02 PM8/13/10
to wxpytho...@googlegroups.com
> Here are some readily available partial documentation and working example
> sources (listed in no particular order):

There's also Andrea's:

http://xoomer.virgilio.it/infinity77/wxPython/APIMain.html

WinCrazy

unread,
Aug 14, 2010, 3:26:01 PM8/14/10
to wxPython-users
Oops, C M, I missed this major doc source. It's very well organized
and very easy to use. Still, wx constants such as
wx.DEFAULT_FRAME_STYLE, etc., etc., have no documentation source that
I've come across, and there sure are a lot of them. Just what style
flags define wx.DEFAULT_FRAME_STYLE ??? (The answer to this one is too
easy. Most wx constants are not defined in any docs.)

I'm sure there are plenty of other people's suggestions for
documentation sources.

Why can't all these be posted as a "sticky note" on the main page so
everyone can see them ?

Ray

C M

unread,
Aug 14, 2010, 10:28:15 PM8/14/10
to wxpytho...@googlegroups.com
On Sat, Aug 14, 2010 at 3:26 PM, WinCrazy <pas...@verizon.net> wrote:
> Oops, C M, I missed this major doc source.  It's very well organized
> and very easy to use. Still, wx constants such as
> wx.DEFAULT_FRAME_STYLE, etc., etc., have no documentation source that
> I've come across,

Unless I misunderstand you, aren't they in the wxWidgets docs (and
therefore Andrea's)?
For wx.DEFAULT_FRAME_STYLE, if you go to the wxWidgets docs, here:

http://docs.wxwidgets.org/2.6/wx_wxframe.html

And look under Window styles, it's there.

In Andrea's, here:
http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.Frame.html

Also under Window styles. I've found those parts of the docs crucial
to knowing what I'm doing when tweaking things.

> and there sure are a lot of them. Just what style
> flags define wx.DEFAULT_FRAME_STYLE ??? (The answer to this one is too
> easy. Most wx constants are not defined in any docs.)

From that page:
"Defined as wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER |
wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN."

Che

mw

unread,
Aug 15, 2010, 2:44:06 AM8/15/10
to wxpytho...@googlegroups.com
Something not as apparent (but well worth a read) are Andrea's AGW specific pages:

werner

unread,
Aug 15, 2010, 4:50:07 AM8/15/10
to wxpytho...@googlegroups.com
On 14/08/2010 02:06, C M wrote:
...At the end of 2008 this started a discussion about the wxPython
documentation, my reading of the conclusion to that thread was.

- base the wxPython docs on the wxWidgets 2.9 docs
- some initial manual work is needed to generate out of the wxWidgets
docs and the wxPython docs (wx.lib etc) the new docs

I don't want to stir things, but would be interested to know where this
all stands.

Could people like myself help in whatever manual work is involved?

Werner

P.S.
Hopefully the wxPython docs will be Sphinx based, which can easily
produce the .cmh, a .pdf and .html versions of the docs.


Andrea Gavana

unread,
Aug 15, 2010, 6:14:50 AM8/15/10
to wxpytho...@googlegroups.com
HI Werner,

On 15 August 2010 11:50, werner wrote:
>  On 14/08/2010 02:06, C M wrote:
> ...
>>
>> There's also Andrea's:
>> http://xoomer.virgilio.it/infinity77/wxPython/APIMain.html
>>
> At the end of 2008 this started a discussion about the wxPython
> documentation, my reading of the conclusion to that thread was.
>
> - base the wxPython docs on the wxWidgets 2.9  docs
> - some initial manual work is needed to generate out of the wxWidgets docs
> and the wxPython docs (wx.lib etc) the new docs
>
> I don't want to stir things, but would be interested to know where this all
> stands.

Your reading is correct: at that time, there was quite a debate about
the docs I produced with Sphinx. The docs generated by Sphinx are
without doubts nicer than the Doxygen-based ones, but a fair point
raised by Kevin, Robin and others was that, with the current way the
docs are handled in SWIG/wxWidgets, too much manual work would be
needed.

However, in order to switch from this state to an easier-to-handle
situation, only one thing would be needed: instruct SWIG to output the
wxPython-friendly help strings inside every method docstring. I.e.,
instead of having:

def __init__(self, *args, **kwargs):
"""
__init__(self, EventType commandType=wxEVT_NULL, int winid=0,
int pos=0,
int orient=0) -> ScrollEvent
"""
_core_.ScrollEvent_swiginit(self,_core_.new_ScrollEvent(*args,
**kwargs))


You would have:

def __init__(self, *args, **kwargs):
"""
Class constructor.

:param `commandType`: eventtype
:param `winid`: int
:param `pos`: int
:param `orient`: int

:return: `wx.ScrollEvent`.
"""

Or something along these lines. Obviously, in this case the parameter
descriptions are not very helpful (they only mention "int"), but if
the description is present in the wxWidgets docs, it would be nice to
have a way to extract them and put them inside the method docstring.
In short, if we can output as much as possible help strings and
documentation strings inside method/class/module docstrings, then the
whole process of generating the documentation with Sphinx can be
automated like a breeze, up to the generation of html, pdf and chm
files.

> Could people like myself help in whatever manual work is involved?

Of course you can: your knowledge of wxPython and of the various
intricacies of the library are extremely useful in analyzing the
slight differences between the wxWidgets docs (C++) and the wxPython
ones, in spotting errors in the automatically generated docs, and in
general provide ideas (and code) on how to best handle the conversion
between C++ docs and Python ones.

However, until Robin has given his final word, I don't think it's wise
to start something just yet... I remember I was bitten quite hard by
people's reactions on the wxPython docs I generated back in 2008...

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

==> Never *EVER* use RemovalGroup for your house removal. You'll
regret it forever.
http://thedoomedcity.blogspot.com/2010/03/removal-group-nightmare.html <==

WinCrazy

unread,
Aug 15, 2010, 2:54:04 PM8/15/10
to wxPython-users
Yes, this is another rich source of info. This should be "wx
documentation source #11 (listed in no particular order)".

All the info there is good, but many crucial explanations are missing.
For one small example, under wx.Boxsizer flags, they are all listed,
but the critical fact that they apply only to the opposite axis to
which the BoxSizer was created is missing. This is critical to know to
be able to understand how the BoxSizer works, yet this little tidbit
is just not there. This, most certainly, wasn't done intentionally,
but no one has bothered to properly review this in all the years it
has been posted there.

You might think this is a trivial example, which it might very well
be, but there are 10,000 other missing critical explanations in the
docs, too. I realize the WxWidgets, Python and wxPython developers
don't get paid for any of their work, but it's obvious that the docs
were not reviewed by "newbies" with a "fresh" view who would be much
more aware of what all the other important info and, especially,
explanations that are missing in the docs.

Ray
Reply all
Reply to author
Forward
0 new messages