[wxPython-users] Trouble positioning window
Robin Dunn
robin at alldunn.com
Tue Mar 4 13:59:19 PST 2008
Jeff Peery wrote:
> Hello,
> I'm having difficulty positioning a window onto of a MDI child frame.
> I've simply created something like the wxTipWindow using a wx.Frame and
> I want to position it at the same location as its parent (MDIChildFrame).
>
> position = self.mdichildframe.GetPosition()
> self.tipwindow.Move(position)
>
> I am thinking this should put the origins the tipwindow at the origin of
> the mdichildframe. but it isn't even close. Also I didn't see anywhere
> in the docs that discussed what these positions are in reference to. if
> I use a GetPosition() does it return a position in reference to the
> parent window or the screen or what...?
The MDIChildFrame's position is relative to the 0,0 of the parent's
client area. Your wx.Frame's position is relative to the screen. To
get the MDIChild's position relative to the screen, use the
ClientToScreen method of the parent. Assuming self is the MDIParent,
the screen position of the child frame would be something like this:
self.ClientToScreen(self.mdichildframe.GetPosition())
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-users
mailing list