[wxPython-users] import modular wxPython frames / apps.

Robin Dunn robin at alldunn.com
Tue Sep 12 08:48:23 PDT 2006


S. D. Rose wrote:
> Hello all.
>   I am making a GUI that's basically a dashboard in python.  I want to know 
> if I can create an individual element, such as a photoviewer, or contact 
> management as individual frames -- a stand-alone program which can be 
> imported into the greater program.  I'm using wxGlade to make the GUI 
> element because, simply, I'm bad at doing this by-hand myself.
> 
>   I've tried this by creating an application -- create a frame -- add a 
> panel, a sizer, and a text-label.  Then I made another in the same way.  I 
> saved them as a.py and b.py.  If I click on them individually, they work. If 
> I make an app, c.py, and add a splitter window, and then on each half of the 
> splitter I add a custom class -- a.FrameA and b.FrameB.  When I add the 
> import statements for import a and import b, and I run c.py, it comes up 
> blank.  

You can't put a frame into a splitter like that.  Frames are top-level 
windows, meaning that they are not constrained by their parent, and they 
can be positioned/sized by the user.  So in your example all you saw 
were the panels that you put in to the splitter and used as the parents 
of the frames, and since you didn't Show() the frames they didn't show 
up as separate top-level windows.

> Does anyone have any suggestions?

You should instead make your component elements be wx.Panels.  Then you 
can put them in a frame to run them standalone, put them in a splitter 
to run two of them at once, or many other possibilities.


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





More information about the wxpython-users mailing list