open a child frame inside the parent frame

Hi,

I am new to wxpython. When I click on a menu item, I would like the child window to open in the same parent window. Any help on this is highly appreciated.

Thanks,
Babylakshmi

···

Babylakshmi Muthusamy
Ph.D. student
Institute of Bioinformatics
7th Floor, Discoverer Building
International Technology Park
Bangalore - 560 066
India
Ph: +91-80-28416140

Hey Babylakshmi,

It sounds like you need to use panels and just Hide(),Show() them. Setup each layout within its own panel, and have the menu item Hide() the unwanted panels, and Show() the panels you want. Also, being new go through the wxPython demos for ideas of what you can layout, and what existing features might be best to utilize.

Chris

···

On Friday, August 17, 2012 5:54:39 AM UTC-4, Babylakshmi Muthusamy wrote:

Hi,

I am new to wxpython. When I click on a menu item, I would like the child window to open in the same parent window. Any help on this is highly appreciated.

Thanks,
Babylakshmi

Babylakshmi Muthusamy
Ph.D. student
Institute of Bioinformatics
7th Floor, Discoverer Building
International Technology Park
Bangalore - 560 066
India
Ph: +91-80-28416140

Hi,

If all you want to do is switch between panels, then you’ll find this tutorial helpful: http://www.blog.pythonlibrary.org/2010/06/16/wxpython-how-to-switch-between-panels/

If you want to center a child frame on the parent frame, then you’ll want to use the CenterOnParent() method.

  • Mike

I am new to wxpython. When I click on a menu item, I would like the child window to open in the same parent window. Any help on this is highly appreciated.

An answer to your question depends much on what you exactly mean. Do you really want a frame to open entirely within another frame? (Here, “frame” means a rectangle with a title bar, close X, minimize button…the outermost rectangle of most desktop applications). If so, the only choice is to use MDIWindows. See the wxPython Demo for that. But MDI is deprecated and is, from what I understand, really not something people favor in this millennium.

If, though, you just want any rectangle to appear within a frame, you would use a wxPanel, placed somewhere you want within that frame.

If, though, you want any rectangle to appear over your main frame, you could use:

  • wxMiniFrame
  • wxDialog
  • wxFrame (as others have said)
  • wxPopupWindow or wxPopupTransientWindow

(and indicate the positioning with a method like dlg.CenterOnParent() )

and maybe others that I forgot. All of these are in the demo. If you find what you want, you can then try to use the Demo’s code to show you how to do it on your own, and if you get stuck, ask this list.

Che