Panel outside of Frame--How?

I would like an example of how one can create a Frame and then create two Panels --- one that is inside and the other outside. If this is impossible then how can a Panel be moved outside it's Frame?

Best regards.

Hi,

I would like an example of how one can create a Frame and then create two
Panels --- one that is inside and the other outside. If this is impossible
then how can a Panel be moved outside it's Frame?

You cannot.

A Panel is an entity that should be embedded into a frame or a dialog
or any toplevel window. If you need to create a panel outside a frame,
just create another frame and embed the second panel in it. Or use AUI
to handle this situation in a smarter way.

Andrea.

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

import PyQt4.QtGui

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named PyQt4.QtGui

import pygtk

Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
ImportError: No module named pygtk

···

On 27 January 2012 16:32, Virgil Stokes wrote:

import wx

Er, to my knowledge every object has to be held within its parent
object. Since the Frame owns both Panels, it must also contain both
Panels. They can overlap each other but they can't be outside the
Frame.

You can get an apparently free-floating Panel by creating a Frame with
a style of 0, though. This will omit the title bar and bordering.
Unfortunately, there's no event you can bind to when a Frame is moved
(as far as I'm aware) so you can't have that style-less Frame follow
another Frame around.

-Chris

···

On Fri, Jan 27, 2012 at 7:32 AM, Virgil Stokes <vs@it.uu.se> wrote:

I would like an example of how one can create a Frame and then create two
Panels --- one that is inside and the other outside. If this is impossible
then how can a Panel be moved outside it's Frame?

Best regards.

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

Hi,

I would like an example of how one can create a Frame and then create two
Panels --- one that is inside and the other outside. If this is impossible
then how can a Panel be moved outside it's Frame?

You cannot.

A Panel is an entity that should be embedded into a frame or a dialog
or any toplevel window.

Yes, I know.

If you need to create a panel outside a frame,
just create another frame and embed the second panel in it.

This I have been unable to accomplish

Or use AUI
to handle this situation in a smarter way.

The AUI types from the wxPython demo does not work on my platform (Windows Vista 32-bit) with the latest release of wxPython

···

On 27-Jan-2012 17:05, Andrea Gavana wrote:

On 27 January 2012 16:32, Virgil Stokes wrote:

Er, to my knowledge every object has to be held within its parent
object. Since the Frame owns both Panels, it must also contain both
Panels. They can overlap each other but they can't be outside the
Frame.

You can get an apparently free-floating Panel by creating a Frame with
a style of 0, though. This will omit the title bar and bordering.

This would be ok for my purposes (I only need to edit regions of the bitmap in the floating panel)

Unfortunately, there's no event you can bind to when a Frame is moved
(as far as I'm aware) so you can't have that style-less Frame follow
another Frame around.

Not sure what you mean here, Chris.

Note, I had a problem with my email server when my first email on this subject was sent and thus, I followed it up with another.

--Best

···

On 27-Jan-2012 17:06, Chris Weisiger wrote:

frame1 = wx.Frame(None)
panel1 = wx.Panel(frame1)
frame2 = wx.Frame(frame1)
panel2 = wx.Panel(frame2)

Is there some reason this approach doesn't work for you?

-Chris

···

On Fri, Jan 27, 2012 at 8:16 AM, Virgil Stokes <vs@it.uu.se> wrote:

On 27-Jan-2012 17:05, Andrea Gavana wrote:

If you need to create a panel outside a frame,
just create another frame and embed the second panel in it.

This I have been unable to accomplish

Please specify Python and wxPython version, and what it means "does
not work" for you.

What error message do you get? What is "not working"?

Andrea.

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

···

On 27 January 2012 17:16, Virgil Stokes wrote:

On 27-Jan-2012 17:05, Andrea Gavana wrote:

Hi,

On 27 January 2012 16:32, Virgil Stokes wrote:

I would like an example of how one can create a Frame and then create two
Panels --- one that is inside and the other outside. If this is
impossible
then how can a Panel be moved outside it's Frame?

You cannot.

A Panel is an entity that should be embedded into a frame or a dialog
or any toplevel window.

Yes, I know.

If you need to create a panel outside a frame,
just create another frame and embed the second panel in it.

This I have been unable to accomplish

Or use AUI
to handle this situation in a smarter way.

The AUI types from the wxPython demo does not work on my platform (Windows
Vista 32-bit) with the latest release of wxPython

What I meant is that if you want to "attach" your apparently
free-floating panel to another frame, then you need to know when that
frame moves, so you can move the panel's frame as well. But there's no
"frame moved" event that you can catch, so far as I'm aware.

If you don't care about frames moving around, then don't worry about it.

···

On Fri, Jan 27, 2012 at 8:21 AM, Virgil Stokes <vs@it.uu.se> wrote:

On 27-Jan-2012 17:06, Chris Weisiger wrote:

Unfortunately, there's no event you can bind to when a Frame is moved
(as far as I'm aware) so you can't have that style-less Frame follow
another Frame around.

Not sure what you mean here, Chris.

Per your request

wxPython vers. -- 2.8 (as in the error messages)

AUI_MDI error:
TypeError: Bind() takes at least 3 arguments (2 given)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8 Docs and Demos\demo\demo.py", line 4, in <module>
   Main.main()
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8 Docs and Demos\demo\Main.py", line 2388, in main
   app.MainLoop()
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 8010, in MainLoop
   wx.PyApp.MainLoop(self)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 7306, in MainLoop
   return _core_.PyApp_MainLoop(*args, **kwargs)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8 Docs and Demos\demo\AUI_MDI.py", line 79, in OnButton
   pf = ParentFrame(self)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8 Docs and Demos\demo\AUI_MDI.py", line 18, in __init__
   self.Bind(wx.EVT_CLOSE)

and nothing is displayed.

···

On 27-Jan-2012 17:22, Andrea Gavana wrote:

On 27 January 2012 17:16, Virgil Stokes wrote:

On 27-Jan-2012 17:05, Andrea Gavana wrote:

Hi,

On 27 January 2012 16:32, Virgil Stokes wrote:

I would like an example of how one can create a Frame and then create two
Panels --- one that is inside and the other outside. If this is
impossible
then how can a Panel be moved outside it's Frame?

You cannot.

A Panel is an entity that should be embedded into a frame or a dialog
or any toplevel window.

Yes, I know.

If you need to create a panel outside a frame,
just create another frame and embed the second panel in it.

This I have been unable to accomplish

Or use AUI
to handle this situation in a smarter way.

The AUI types from the wxPython demo does not work on my platform (Windows
Vista 32-bit) with the latest release of wxPython

Please specify Python and wxPython version, and what it means "does
not work" for you.

What error message do you get? What is "not working"?

Nonononono, there is only one true AUI, the one in wx.lib.agw.aui :smiley:
. Moreover, you shouldn't run the MDI demos in any case, because as
far as I understand this is not what you are after.

Try and run the AUI demo under the AGW library and see what happens.
As an alternative, try and run the original wx.aui sample
(AUI_DockingWindowMgr) from the demo.

Andrea.

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

···

On 27 January 2012 17:27, Virgil Stokes wrote:

On 27-Jan-2012 17:22, Andrea Gavana wrote:

On 27 January 2012 17:16, Virgil Stokes wrote:

On 27-Jan-2012 17:05, Andrea Gavana wrote:

Hi,

On 27 January 2012 16:32, Virgil Stokes wrote:

I would like an example of how one can create a Frame and then create
two
Panels --- one that is inside and the other outside. If this is
impossible
then how can a Panel be moved outside it's Frame?

You cannot.

A Panel is an entity that should be embedded into a frame or a dialog
or any toplevel window.

Yes, I know.

If you need to create a panel outside a frame,
just create another frame and embed the second panel in it.

This I have been unable to accomplish

Or use AUI
to handle this situation in a smarter way.

The AUI types from the wxPython demo does not work on my platform
(Windows
Vista 32-bit) with the latest release of wxPython

Please specify Python and wxPython version, and what it means "does
not work" for you.

What error message do you get? What is "not working"?

Per your request

wxPython vers. -- 2.8 (as in the error messages)

AUI_MDI error:
TypeError: Bind() takes at least 3 arguments (2 given)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8
Docs and Demos\demo\demo.py", line 4, in <module>
Main.main()
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8
Docs and Demos\demo\Main.py", line 2388, in main
app.MainLoop()
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line
8010, in MainLoop
wx.PyApp.MainLoop(self)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line
7306, in MainLoop
return _core_.PyApp_MainLoop(*args, **kwargs)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8
Docs and Demos\demo\AUI_MDI.py", line 79, in OnButton
pf = ParentFrame(self)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8
Docs and Demos\demo\AUI_MDI.py", line 18, in __init__
self.Bind(wx.EVT_CLOSE)

and nothing is displayed.

AUI runs ok in the AGW library; but I fail to see how this example helps with my original problem.
Perhaps you could clarify...

···

On 27-Jan-2012 17:32, Andrea Gavana wrote:

On 27 January 2012 17:27, Virgil Stokes wrote:

On 27-Jan-2012 17:22, Andrea Gavana wrote:

On 27 January 2012 17:16, Virgil Stokes wrote:

On 27-Jan-2012 17:05, Andrea Gavana wrote:

Hi,

On 27 January 2012 16:32, Virgil Stokes wrote:

I would like an example of how one can create a Frame and then create
two
Panels --- one that is inside and the other outside. If this is
impossible
then how can a Panel be moved outside it's Frame?

You cannot.

A Panel is an entity that should be embedded into a frame or a dialog
or any toplevel window.

Yes, I know.

If you need to create a panel outside a frame,
just create another frame and embed the second panel in it.

This I have been unable to accomplish

Or use AUI
to handle this situation in a smarter way.

The AUI types from the wxPython demo does not work on my platform
(Windows
Vista 32-bit) with the latest release of wxPython

Please specify Python and wxPython version, and what it means "does
not work" for you.

What error message do you get? What is "not working"?

Per your request

wxPython vers. -- 2.8 (as in the error messages)

AUI_MDI error:
TypeError: Bind() takes at least 3 arguments (2 given)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8
Docs and Demos\demo\demo.py", line 4, in<module>
  Main.main()
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8
Docs and Demos\demo\Main.py", line 2388, in main
  app.MainLoop()
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line
8010, in MainLoop
  wx.PyApp.MainLoop(self)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line
7306, in MainLoop
  return _core_.PyApp_MainLoop(*args, **kwargs)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8
Docs and Demos\demo\AUI_MDI.py", line 79, in OnButton
  pf = ParentFrame(self)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8
Docs and Demos\demo\AUI_MDI.py", line 18, in __init__
  self.Bind(wx.EVT_CLOSE)

and nothing is displayed.

Nonononono, there is only one true AUI, the one in wx.lib.agw.aui :smiley:
. Moreover, you shouldn't run the MDI demos in any case, because as
far as I understand this is not what you are after.

Try and run the AUI demo under the AGW library and see what happens.
As an alternative, try and run the original wx.aui sample
(AUI_DockingWindowMgr) from the demo.

This is ok; but, how does one setup the app.MainLoop() to handle the two panels?

···

On 27-Jan-2012 17:21, Chris Weisiger wrote:

On Fri, Jan 27, 2012 at 8:16 AM, Virgil Stokes<vs@it.uu.se> wrote:

On 27-Jan-2012 17:05, Andrea Gavana wrote:

If you need to create a panel outside a frame,
just create another frame and embed the second panel in it.

This I have been unable to accomplish

frame1 = wx.Frame(None)
panel1 = wx.Panel(frame1)
frame2 = wx.Frame(frame1)
panel2 = wx.Panel(frame2)

···

On Fri, Jan 27, 2012 at 8:40 AM, Virgil Stokes <vs@it.uu.se> wrote:

On 27-Jan-2012 17:21, Chris Weisiger wrote:

On Fri, Jan 27, 2012 at 8:16 AM, Virgil Stokes<vs@it.uu.se> wrote:

On 27-Jan-2012 17:05, Andrea Gavana wrote:

If you need to create a panel outside a frame,
just create another frame and embed the second panel in it.

This I have been unable to accomplish

frame1 = wx.Frame(None)
panel1 = wx.Panel(frame1)
frame2 = wx.Frame(frame1)
panel2 = wx.Panel(frame2)

This is ok; but, how does one setup the app.MainLoop() to handle the two
panels?

The DockingWindowMgr demo worked also; but, what is the connection to my original problem?

···

On 27-Jan-2012 17:32, Andrea Gavana wrote:

On 27 January 2012 17:27, Virgil Stokes wrote:

On 27-Jan-2012 17:22, Andrea Gavana wrote:

On 27 January 2012 17:16, Virgil Stokes wrote:

On 27-Jan-2012 17:05, Andrea Gavana wrote:

Hi,

On 27 January 2012 16:32, Virgil Stokes wrote:

I would like an example of how one can create a Frame and then create
two
Panels --- one that is inside and the other outside. If this is
impossible
then how can a Panel be moved outside it's Frame?

You cannot.

A Panel is an entity that should be embedded into a frame or a dialog
or any toplevel window.

Yes, I know.

If you need to create a panel outside a frame,
just create another frame and embed the second panel in it.

This I have been unable to accomplish

Or use AUI
to handle this situation in a smarter way.

The AUI types from the wxPython demo does not work on my platform
(Windows
Vista 32-bit) with the latest release of wxPython

Please specify Python and wxPython version, and what it means "does
not work" for you.

What error message do you get? What is "not working"?

Per your request

wxPython vers. -- 2.8 (as in the error messages)

AUI_MDI error:
TypeError: Bind() takes at least 3 arguments (2 given)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8
Docs and Demos\demo\demo.py", line 4, in<module>
  Main.main()
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8
Docs and Demos\demo\Main.py", line 2388, in main
  app.MainLoop()
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line
8010, in MainLoop
  wx.PyApp.MainLoop(self)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line
7306, in MainLoop
  return _core_.PyApp_MainLoop(*args, **kwargs)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8
Docs and Demos\demo\AUI_MDI.py", line 79, in OnButton
  pf = ParentFrame(self)
File "c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\wx\demos\wxPython2.8
Docs and Demos\demo\AUI_MDI.py", line 18, in __init__
  self.Bind(wx.EVT_CLOSE)

and nothing is displayed.

Nonononono, there is only one true AUI, the one in wx.lib.agw.aui :smiley:
. Moreover, you shouldn't run the MDI demos in any case, because as
far as I understand this is not what you are after.

Try and run the AUI demo under the AGW library and see what happens.
As an alternative, try and run the original wx.aui sample
(AUI_DockingWindowMgr) from the demo.

Ok! thanks very much Chris --- I now have something that I can use to explore further.
Have a good day!

···

On 27-Jan-2012 17:43, Chris Weisiger wrote:

On Fri, Jan 27, 2012 at 8:40 AM, Virgil Stokes<vs@it.uu.se> wrote:

On 27-Jan-2012 17:21, Chris Weisiger wrote:

On Fri, Jan 27, 2012 at 8:16 AM, Virgil Stokes<vs@it.uu.se> wrote:

On 27-Jan-2012 17:05, Andrea Gavana wrote:

If you need to create a panel outside a frame,
just create another frame and embed the second panel in it.

This I have been unable to accomplish

frame1 = wx.Frame(None)
panel1 = wx.Panel(frame1)
frame2 = wx.Frame(frame1)
panel2 = wx.Panel(frame2)

This is ok; but, how does one setup the app.MainLoop() to handle the two
panels?

import wxclass App(wx.App): def OnInit(self): frame1 = wx.Fram - Pastebin.com

EVT_MOVE

···

On 1/27/12 8:23 AM, Chris Weisiger wrote:

On Fri, Jan 27, 2012 at 8:21 AM, Virgil Stokes<vs@it.uu.se> wrote:

On 27-Jan-2012 17:06, Chris Weisiger wrote:

Unfortunately, there's no event you can bind to when a Frame is moved
(as far as I'm aware) so you can't have that style-less Frame follow
another Frame around.

Not sure what you mean here, Chris.

What I meant is that if you want to "attach" your apparently
free-floating panel to another frame, then you need to know when that
frame moves, so you can move the panel's frame as well. But there's no
"frame moved" event that you can catch, so far as I'm aware.

--
Robin Dunn
Software Craftsman

The MainLoop services all windows in the application, it is not limited to just one frame.

···

On 1/27/12 8:40 AM, Virgil Stokes wrote:

On 27-Jan-2012 17:21, Chris Weisiger wrote:

On Fri, Jan 27, 2012 at 8:16 AM, Virgil Stokes<vs@it.uu.se> wrote:

On 27-Jan-2012 17:05, Andrea Gavana wrote:

If you need to create a panel outside a frame,
just create another frame and embed the second panel in it.

This I have been unable to accomplish

frame1 = wx.Frame(None)
panel1 = wx.Panel(frame1)
frame2 = wx.Frame(frame1)
panel2 = wx.Panel(frame2)

This is ok; but, how does one setup the app.MainLoop() to handle the two
panels?

--
Robin Dunn
Software Craftsman

They are suggesting that AUI can be used to manage your floating panel, with the added benefit that it can also allow that panel to be docked or undocked in the main frame by the user.

···

On 1/27/12 8:44 AM, Virgil Stokes wrote:

On 27-Jan-2012 17:32, Andrea Gavana wrote:

Try and run the AUI demo under the AGW library and see what happens.
As an alternative, try and run the original wx.aui sample
(AUI_DockingWindowMgr) from the demo.

The DockingWindowMgr demo worked also; but, what is the connection to my
original problem?

--
Robin Dunn
Software Craftsman

Ahh, I didn't see that on the list of events that wx.Frame processes here:
http://docs.wxwidgets.org/2.9.2/classwx_frame.html
so I assumed there was none (especially since wx.Window also doesn't
list any movement events). So is the documentation out of date?

-Chris

···

On Fri, Jan 27, 2012 at 8:51 AM, Robin Dunn <robin@alldunn.com> wrote:

On 1/27/12 8:23 AM, Chris Weisiger wrote:

What I meant is that if you want to "attach" your apparently
free-floating panel to another frame, then you need to know when that
frame moves, so you can move the panel's frame as well. But there's no
"frame moved" event that you can catch, so far as I'm aware.

EVT_MOVE

It is shown in the docs for wxTopLevelWindow (the base class of wxFrame) and also in the docs for wxMoveEvent.

···

On 1/27/12 8:56 AM, Chris Weisiger wrote:

On Fri, Jan 27, 2012 at 8:51 AM, Robin Dunn<robin@alldunn.com> wrote:

On 1/27/12 8:23 AM, Chris Weisiger wrote:

What I meant is that if you want to "attach" your apparently
free-floating panel to another frame, then you need to know when that
frame moves, so you can move the panel's frame as well. But there's no
"frame moved" event that you can catch, so far as I'm aware.

EVT_MOVE

Ahh, I didn't see that on the list of events that wx.Frame processes here:
http://docs.wxwidgets.org/2.9.2/classwx_frame.html
so I assumed there was none (especially since wx.Window also doesn't
list any movement events). So is the documentation out of date?

--
Robin Dunn
Software Craftsman