wxPython : getting started

D

David Sulc

Hi !

I've looked all over (internet, books, etc.) and I haven't found a very
good ressource to get started with wxPython (yes, I've been through
their tutorial).

What I would basically like to do for starters is to be able to define
the main panel being displayed. For example :
1. wxFrame contains a wxPanel (call it mainPanel).
2. mainPanel contains another panel (childPanelA)
3. another panel has been defined (childPanelB) but is not displayed
(the user can only see childPanelA inside mainPanel)
4. by clicking on a menu entry (for example), the displayed panel is now
childPanelA (which is inside mainPanel)

So how do I do this ? I realize it's a very basic question, but it's
been driving me mad...

Also, is there any good open source wxPython program that I could study ?

Thanks for any help...
 
C

Colin J. Williams

David said:
Hi !

I've looked all over (internet, books, etc.) and I haven't found a very
good ressource to get started with wxPython (yes, I've been through
their tutorial).

What I would basically like to do for starters is to be able to define
the main panel being displayed. For example :
1. wxFrame contains a wxPanel (call it mainPanel).
2. mainPanel contains another panel (childPanelA)
3. another panel has been defined (childPanelB) but is not displayed
(the user can only see childPanelA inside mainPanel)
4. by clicking on a menu entry (for example), the displayed panel is now
childPanelA (which is inside mainPanel)

So how do I do this ? I realize it's a very basic question, but it's
been driving me mad...

Also, is there any good open source wxPython program that I could study ?

Thanks for any help...
David,

I'm dodging your question but you might find this soon to be released
book helpful:
http://www.manning.com/books/rappin

Also Boa Constructor is a helpful tool.

Colin W.
 
T

Tony Nelson

David Sulc said:
Hi !

I've looked all over (internet, books, etc.) and I haven't found a very
good ressource to get started with wxPython (yes, I've been through
their tutorial).

What I would basically like to do for starters is to be able to define
the main panel being displayed. For example :
1. wxFrame contains a wxPanel (call it mainPanel).
2. mainPanel contains another panel (childPanelA)
3. another panel has been defined (childPanelB) but is not displayed
(the user can only see childPanelA inside mainPanel)
4. by clicking on a menu entry (for example), the displayed panel is now
childPanelA (which is inside mainPanel)

So how do I do this ? I realize it's a very basic question, but it's
been driving me mad...
...

I don't know or use wxWidgets, and I've just learned GTK, but I think
one good answer is the same as with GTK: use a wxNotebook. You may be
able to hide the tabs, or you may just decide they're a good thing to
have.

To do what you asked, see the wxWindow method Show(), which you would
call for each or A and B etc. in response to the command.
________________________________________________________________________
TonyN.:' *firstname*nlsnews@georgea*lastname*.com
' <http://www.georgeanelson.com/>
 
H

hrh1818

One possible source of help is the book "Python Programming on Win 32".
It has a 20 page introducrtion on using wxPython.

Howard
 
P

Peter Milliken

The book that Colin points out looks good - but not available until Jan
2006. When it comes out I might buy it - just out of curiosity :)

Personally I "bounced" when I attempted to learn wxPython - I found it much
easier to learn and use Tkinter combined with Pmw.

I really tried on the wxPython as well - it wasn't just a 1/2hr exercise :)
I must have spent between 4 - 6 weeks attempting to get my head around it
before giving up. The Pmw/TkInter combination was much easier to get up and
going with. Pmw is incredibly powerful once you get the ghist of its core
i.e. the MegaWidget, MegaArchetype etc.

Having said that, I still have my printer utility (Win32) written using
wxPython - I never could work out how to get that working with Pmw/TkInter.
I just used sockets to transfer the text to be printed between the wxPython
print utility and my TkInter/Pmw based application :)

Peter
 
M

Magnus Lycka

hrh1818 said:
One possible source of help is the book "Python Programming on Win 32".
It has a 20 page introducrtion on using wxPython.

I think that's pretty much out of date though, unless there is a
2nd edition that I missed. I can't say that I remember that chapter,
but wxPython changed quite a bit since that book was written. It's
still a good book though!
 
M

Magnus Lycka

Peter said:
Personally I "bounced" when I attempted to learn wxPython - I found it much
easier to learn and use Tkinter combined with Pmw.

It's my impression that Pmw isn't really maintained. AFAIK, the last
release (as well as the last CVS commit) is more than two years old.
 
P

Peter Milliken

Magnus,

Not sure what gave you that idea - there is a Pmw mailing list and very,
very occasionally email activity on it - I believe the product is
maintained, it is most likely considered "complete" in and of itself.
Certainly if there is some object that is not present in the collection then
you can easily create one to your specifications/requirements using the
MegaWidget and MegaArchetype base classes.

Even elements that are not in the Pmw collection - such as elements found in
the BLT are catered for with the Pmw - BLT interface and the "A Users Guide
to Pmw.Blt".

Perhaps the authors should create a new "release" every 6 months or so just
so people don't get this (mistaken) impression - I am just not sure what
they should put into each new "release" :)

Regards,
Peter
 
F

Fredrik Lundh

Peter said:
Perhaps the authors should create a new "release" every 6 months or so just
so people don't get this (mistaken) impression - I am just not sure what they
should put into each new "release" :)

just bump the version number slightly, and add a "tested with <latest
minor python release>" to the README file.

</F>
 
S

Steve Holden

David said:
Hi !

I've looked all over (internet, books, etc.) and I haven't found a very
good ressource to get started with wxPython (yes, I've been through
their tutorial).

What I would basically like to do for starters is to be able to define
the main panel being displayed. For example :
1. wxFrame contains a wxPanel (call it mainPanel).
2. mainPanel contains another panel (childPanelA)
3. another panel has been defined (childPanelB) but is not displayed
(the user can only see childPanelA inside mainPanel)
4. by clicking on a menu entry (for example), the displayed panel is now
childPanelA (which is inside mainPanel)

So how do I do this ? I realize it's a very basic question, but it's
been driving me mad...

Also, is there any good open source wxPython program that I could study ?

Thanks for any help...

Without wishing to hijack this thread, I have just been encouraged by
the PyCon organisers to publicise one of the tutorials I'll be giving
the day before PyCon proper starts. Yes, it's a programmer's
introduction to wxPython. See:


http://wiki.python.org/moin/PyCon2006/Tutorials/GettingStartedWithWxPython

regards
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,157
Latest member
MercedesE4
Top