[wxpython-users] Styles in widgets constructors

1 view
Skip to first unread message

Gabriel

unread,
Apr 20, 2009, 8:14:33 AM4/20/09
to wxpytho...@lists.wxwidgets.org
Hello,

is there something like a list of styles for each type of widget? For
example list of styles with some descriptions which i can use in wxPanel
constructor..

--
Gabriel

Cody Precord

unread,
Apr 20, 2009, 8:27:18 AM4/20/09
to wxpytho...@lists.wxwidgets.org

Rene Heymans

unread,
Apr 20, 2009, 9:50:50 AM4/20/09
to wxpytho...@lists.wxwidgets.org
Dear Gabriel, Cody,
 
Styles are like any other "constant" defined in wxPython.
 
1) First of all, it appears that all constants are always written in CAPITAL LETTERS, for instance wx.THICK_FRAME or wx.OK.
 
2) When using any tool that gives you the "Locals", i.e. the names known in the local namespace, you can 'visually' see them as they are in CAPITAL LETTERS. For instance, start PyCrust, then, in the terminal window, write after the prompt >>> import wx, then go to the Namespace folio (see attached picture) and you will see the many defined constant names. Obviously, they are not all "STYLE" constants.
 
3) In the example shown (the name is wx.TB_BOTTOM). The integer value is of no importance but the name is important.  In order to find out what it is, you need to look into the documentation. One easy way is to look at :
which is the index of all wxPython widget. In the case of this example, it is quite easy to "guess" what it relates too. Select the T letter in the index list. The first item is wx.TaskBarIcon ... TB ... why not try this one !? Oops ... nothing there. Go bakc to the T list of widgets. Continue browsing, and you get to wx.ToolBar ... Ok let's try this one. And indeed ! There you find all the styles belonging to the Tool Bar widget http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.ToolBar.html and you'll get the explanation of the wx.TB_BOTTOM style.
 
4) Now, not every wx.THIS_IS_A_CONSTANT is a style ! For instance wx.YEs, wx.CANCEL are not styles. But if you get the documentation about a widget, e.g. http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.MiniFrame.html, you will find all the styles of that widget. By the way, regarding this one, there is a typo in the "wxPython in Action" (p.245): the style flags are wx.TINY_CAPTION_HORIZ and wx.TINY_CAPTION_VERT (and not ...HORIZONTAL and ...VERTICAL). This is why a tool like PyCrust that gives you auto-completion is useful: the list is the actual one !
 
5) The reverse is not that easy. Suppose there is a constant like wx.THICK_FRAME in the code. What is this ? Is this a style ? if yes, of what: a window, a frame, a dialog, a widget ? ... So far, I haven't got the answer. If you pass this to the search engine http://xoomer.virgilio.it/infinity77/wxPython/search.html?q=THICK_FRAME&check_keywords=yes&area=default it doesn't find anything. If you go up each class from the MiniFrame class, no luck either ... This style is mentionned on p.245 but I can't find the corresponding doc.   :-(     [NOTE: THICK_FRAME appears on p. 245 of "wxPython in Action" and in the Namespace of PyCrust but is not in the documentation ?!] Similarly, when browsing the Namespace within PyCrust, you find the wx.wxTR_AQUA_BUTTONS at the bottom of the list. I haven't found so far where this is used !? Is is a mis-spelling for wx.TR_AQUA_BUTTONS ? If you look at the styles for wx.TreeCtrl there are a number of wx.TR_SOMETHING but no AQUA !? I'm a a loss here. Sorry. Maybe someone can shed light on this.
 
This is my modest contribution.
Good day, Rene
 


 
_______________________________________________
wxpython-users mailing list
wxpytho...@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Mike Driscoll

unread,
Apr 20, 2009, 10:49:47 AM4/20/09
to wxpytho...@lists.wxwidgets.org

Hmmm...this thread lists the common style flags for various windows:

http://lists.wxwidgets.org/pipermail/wxpython-users/2004-April/027891.html

But there doesn't seem to be a source of documentation on which style
flags go where or what they do exactly. Most of the time, the name of
the style will tell you though.

It looks like TR_AQUA_BUTTONS is referenced like this:
wx.wxTR_AQUA_BUTTONS. It is in the _controls.py file underneath a
comment that says it is obsolete. I think it is there to support a style
on an old OS, maybe a Mac?

Hopefully the new vaunted docs will better explain the style flags. In
the mean time, Robin's book is pretty much the only source I have for
this sort of thing. Too bad the index sucks for finding this kind of stuff.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

Cody Precord

unread,
Apr 20, 2009, 11:17:14 AM4/20/09
to wxpytho...@lists.wxwidgets.org
Hello,

On Mon, Apr 20, 2009 at 9:49 AM, Mike Driscoll <mi...@pythonlibrary.org> wrote:

Hmmm...this thread lists the common style flags for various windows:

http://lists.wxwidgets.org/pipermail/wxpython-users/2004-April/027891.html

But there doesn't seem to be a source of documentation on which style flags go where or what they do exactly. Most of the time, the name of the style will tell you though.

The online wxWidgets docs have pretty good (if not complete) listing for each class.

1) http://docs.wxwidgets.org and select the version your using

2) Alphabetical class list: http://docs.wxwidgets.org/2.8.9/wx_classref.html#classref

3) Find the class you want to know the style flags for (i.e wxFrame).

4) http://docs.wxwidgets.org/2.8.9/wx_wxframe.html#wxframe

There is a nice table with all the styles and descriptions of them near the top of each classes documentation that explains the various styles flags available for that class.

Then to translate the cpp docs to python simply insert a '.' between the wx and the class name 'wxFrame' => 'wx.Frame' ;)


Cody


Mike Driscoll

unread,
Apr 20, 2009, 11:55:56 AM4/20/09
to wxpytho...@lists.wxwidgets.org

Oops...I forgot about the wxWidgets docs. Duh!

Mike

Mike Driscoll

unread,
Apr 20, 2009, 1:43:22 PM4/20/09
to wxpytho...@lists.wxwidgets.org
Rene,
> Hello Mike, Cody, & al.
>
> About documentation, after many trials, I now go to Andrea's
> documentation site
> http://xoomer.virgilio.it/infinity77/wxPython/APIMain.html which I
> find almost completely documented and foremost "visually attractive"
> (wait till you get over 55 and you will have to abandon the sleek
> dense screen with tiny letters ... ;-) ... ) . If there is something
> I can't find, I go to the wxWidgets docs (quite nice and complete too
> but in C++ jargon). The other reason I like Andrea's documentation is
> that it looks similar to the new Python 3 doc.
>
> The other day I saw a short note about doc mentionning Doxygen,
> Sphynx, and ... ?? can't remember. I'm not at all versed in these
> documentation tools but from a user point of view, next to accuracy
> and completeness I favour very much beauty and elegance.
>
> Would it not be a reasonable idea to consolidate all the wxPython
> documentation effort under one presentation.
>
> "Beauty before age" ... :-)
>
> Good day to all of you,
> Rene
>
>

Andrea is using Sphinx for his documentation, as is the Python docs
pages. The new docs for wxPython will be in Doxygen, which sounds
similar to Sphinx. There's a list of sites that use Doxygen here:
http://www.stack.nl/~dimitri/doxygen/projects.html . It looks kind of
plain, but not bad.

Rene Heymans

unread,
Apr 20, 2009, 1:22:03 PM4/20/09
to wxpytho...@lists.wxwidgets.org
Hello Mike, Cody, & al.
 
About documentation, after many trials, I now go to Andrea's documentation site http://xoomer.virgilio.it/infinity77/wxPython/APIMain.html which I find almost completely documented and foremost "visually attractive" (wait till you get over 55 and you will have to abandon the sleek dense screen with tiny letters ... ;-)  ... ) . If there is something I can't find, I go to the wxWidgets docs (quite nice and complete too but in C++ jargon). The other reason I like Andrea's documentation is that it looks similar to the new Python 3 doc.
 
The other day I saw a short note about doc mentionning Doxygen, Sphynx, and ... ?? can't remember. I'm not at all versed in these documentation tools but from a user point of view, next to accuracy and completeness I favour very much beauty and elegance.
 
Would it not be a reasonable idea to consolidate all the wxPython documentation effort under one presentation.
 
"Beauty before age" ... :-)
 
Good day to all of you,
Rene
 
 
 

Andrea Gavana

unread,
Apr 21, 2009, 4:13:42 AM4/21/09
to wxpytho...@lists.wxwidgets.org
Hi Rene,

On Mon, Apr 20, 2009 at 6:22 PM, Rene Heymans wrote:
> Hello Mike, Cody, & al.
>
> About documentation, after many trials, I now go to Andrea's documentation
> site http://xoomer.virgilio.it/infinity77/wxPython/APIMain.html which I find
> almost completely documented and foremost "visually attractive" (wait till
> you get over 55 and you will have to abandon the sleek dense screen with
> tiny letters ... ;-)  ... ) . If there is something I can't find, I go to
> the wxWidgets docs (quite nice and complete too but in C++ jargon). The
> other reason I like Andrea's documentation is that it looks similar to the
> new Python 3 doc.
>
> The other day I saw a short note about doc mentionning Doxygen, Sphynx, and
> ... ?? can't remember. I'm not at all versed in these documentation tools
> but from a user point of view, next to accuracy and completeness I favour
> very much beauty and elegance.

So do I ;-)

<rant>

There was a discussion some time ago about the work I did with the
wxPython documentation and Sphinx: it looked like the general opinion
of wxPython *users* was that the Sphinx docs were reasonably good (in
terms of beauty and elegance, to use your wording), but it seemed to
me that the big wxPython bosses decided that, as wxWidgets is using
Doxygen, wxPython has to use Doxygen too. An example of how the
wxWidgets docs look like in the development trunk is here:

http://docs.wxwidgets.org/trunk/classwx_animation_ctrl.html

I have nothing against Doxygen, the only points I tried to make (and I
failed) were that Doxygen docs are no match for Sphinx docs (see an
example of what you can do with Sphinx here:
http://matplotlib.sourceforge.net/api/pyplot_api.html) and that, by
using Sphinx, we were bringing closer the wxPython docs and the Python
docs.

</rant>

Andrea.

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

Robin Dunn

unread,
Apr 21, 2009, 4:33:57 PM4/21/09
to wxpytho...@lists.wxwidgets.org
Andrea Gavana wrote:

> <rant>
>
> There was a discussion some time ago about the work I did with the
> wxPython documentation and Sphinx: it looked like the general opinion
> of wxPython *users* was that the Sphinx docs were reasonably good (in
> terms of beauty and elegance, to use your wording), but it seemed to
> me that the big wxPython bosses decided that, as wxWidgets is using
> Doxygen, wxPython has to use Doxygen too.

Note quite. The final decision for the docs hasn't been made yet.

On the other hand, we will however be using Doxygen in some way for
generating the C++ wrapper code for wxPython. Either the same input as
is given to doxygen for the C++ docs, or more likely doxygen's XML
output. What exactly is being generated is also still to be decided.
In addition to C++ wrapper code it may or may not include docs, or it
may just generate docstrings that can be processed by some other Python
tool, or something in between.

The intent of this exercise is to reduce the amount of work needed to
maintain wxPython and keep it in sync with wxWidgets. By using the XML
output of doxygen (or reusing its input somehow) then much more is
automated than it is now, and as soon as one of the C++ developers makes
a change there then that change can also appear in wxPython's next
build. We just need to develop the tools, make decisions on which
direction to go with them, and come up with a good way to override the
tools for the cases where customization are needed.


--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Christopher Barker

unread,
Apr 21, 2009, 6:13:21 PM4/21/09
to wxpytho...@lists.wxwidgets.org
Andrea Gavana wrote:
> There was a discussion some time ago about the work I did with the
> wxPython documentation and Sphinx: it looked like the general opinion
> of wxPython *users* was that the Sphinx docs were reasonably good (in
> terms of beauty and elegance, to use your wording),

Yes Sphinx docs are nice -- I think we all agree on that.

> me that the big wxPython bosses decided that, as wxWidgets is using
> Doxygen, wxPython has to use Doxygen too.

I don't think it's as simple as that. I'm not one of the "bosses",
indeed, anyone that does a significant amount of work is a boss, if you
ask me, and that includes you!

Anyway, I think the key issue is that wxPython is built on top of
wxWidgets, so we need an automatic way to go from changes in wxWidgets
to the wxPython docs, without hand manipulation. The "new docs" were a
start to that process. I think we could use Sphinx to go from python
docstrings to docs, but we still need a good way to go from the C++ ,
and it's comments, to the python doc strings, and Doxygen may help with
that.

We also need a way to add the extra stuff -- examples, pointers to the
Wiki, etc, etc, and I think Sphinx has some good features for that.

In any case, if someone actually builds something nice, like you have
with your docs, that gives you a lot of leverage for declaring how to do
it in the future.

-Chris


--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris....@noaa.gov

Reply all
Reply to author
Forward
0 new messages