Placing controls, wxWindows

John Ladasky ladasky at my-deja.com
Fri Jun 13 15:33:45 EDT 2003


"MK" <MK at foo.com> wrote in message news:<bcckjp$hpu88$1 at ID-174077.news.dfncis.de>...
> I have problems while placing wxNotebook in a wxPanel.
> For the time being I'm using
> 
>     self.SetDimensions(0, 0, 1000, 600)
> 
> ... in my wxNotebook-derived class, but obviously that's
> not what I want. If I omit the line above, then my notebook
> shrinks to about 100x20 pixels. (I can barely see the tabs!)
> Does anybody know how can I have my wxNotebook
> adjust its size automatically, relatively to its parent wxPanel?
> Thx,
> 
> The hierarchy is:
> 
> wxFrame
>     wxPanel
>         wxNotebook

You need to do a few things:

1) Visit http://wxwindows.org/ and get familiar with the resources
there.  If you haven't downloaded the wxWindows reference, do so --
but I will caution you that it will be a bit of a challenge to
understand.

First of all, wxWindows is written in C++, and logically the wxWindows
reference is written for C++ programmers.  If you do not know C++, you
may find it difficult to translate what you are reading into Python. 
Some folks are working on a wxPython reference, but it isn't done yet.

Second, not all of the wxWindows classes have been wrapped with Python
code.  You cannot just page through the wxWindows reference and say,
"I'll use that class in wxPython."  That class may not yet exist.  It
may not ever exist.  This is not a huge disadvantage -- most of the
classes that haven't been wrapped are pretty obscure ones -- but you
need to be aware of this when you are reading the wxWindows reference.
 Most of the wxWindows classes that are wrapped in wxPython can be
found in the demonstration program that comes with it.

2) Subscribe to the wxPython mailing list.  Many levels of wxPython
users can be found there, from relative newbies like myself all the
way up to Robin Dunn and Patrick O'Brien who (along with other
people?) are the authors of wxPython.  I have received a lot of help
there.  To subscribe to the list, send a message to
wxPython-users-subscribe at lists.wxwindows.org.

3) To address the specific question that you have right now: you need
one additional object in your hierarchy, called a sizer.  There are
several types of sizer objects, and there is one that is specific for
wxNotebook objects called a wxNotebookSizer.  Take a look at the
example code in the wxPython demo.  They have an example of a notebook
in a sizer.

Good luck!

--
John J. Ladasky Jr., Ph.D.
Department of Biology
Johns Hopkins University
Baltimore MD 21218
USA
Earth




More information about the Python-list mailing list