Quantcast

wx.Frame - Maximize() not maximizing completely

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

wx.Frame - Maximize() not maximizing completely

Vlastimil Brom
Hi all,
I'd like to ask about the supposed usage of frame.Maximize() (in wxPython) as I experience some visual glitches even in a very simple app.
I'd like the application to start in a maximized window. Unfortunately, I haven't been able to accomplish this easily.
E.g. a trivial app like:

#! Python
# -*- coding: utf-8 -*-

import wx
appl = wx.App()
frm = wx.Frame(None, -1, "test wx.TextCtrl") #, style=wx.DEFAULT_FRAME_STYLE | wx.MAXIMIZE
testTxtCtrl = wx.TextCtrl(frm, -1, style=wx.TE_MULTILINE | wx.TE_RICH2)
sizerFrm = wx.BoxSizer(wx.HORIZONTAL)
sizerFrm.Add(testTxtCtrl, 1, wx.EXPAND)
frm.SetSizer(sizerFrm)

frm.Maximize()
frm.Show(1)
# frm.Maximize()

appl.MainLoop()

The style parameter of the frame wx.MAXIMIZE (on its own) doesn't seem to have any effect (However, there are some remarks in other thread http://aspn.activestate.com/ASPN/Mail/Message/wxpython-users/3322244 that this wouldn't work with py2exe, hence I couldn't use it anyway).

If Maximize() is called  before Show(1), the window gets allmost maximized, however, there remains some space near the right and bottom border (approx. 8 pixels) where some background layer or the window of another open application can be seen. This glitch disappears e.g. after the manual maximize (or in a more complex app using aui after resizing a aui pane too).
If the Maximize() call is moved after Show(1) (now commented out), the result ist correct - a fully maximized window - however there is a noticeble flicker at startup, which I'd rather like to avoid.
I am using Python 2.5.2, and wxPython 2.8.7.1 (msw-unicode) - win XPh.

Am I doing something wrong or are there other ways to achieve this?

Thanks in advance,
                    Vlasta

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.Frame - Maximize() not maximizing completely

Robin Dunn
Vlastimil Brom wrote:

> If Maximize() is called  before Show(1), the window gets allmost
> maximized, however, there remains some space near the right and bottom
> border (approx. 8 pixels) where some background layer or the window of
> another open application can be seen. This glitch disappears e.g. after
> the manual maximize (or in a more complex app using aui after resizing a
> aui pane too).

I expect that it is simply something like a lack of a size event at the
maximized size, so the layout isn't resizing the child widget to the
final size.  Try adding a call to frm.Layout().


> If the Maximize() call is moved after Show(1) (now commented out), the
> result ist correct - a fully maximized window - however there is a
> noticeble flicker at startup, which I'd rather like to avoid.

It's the animation of starting with a standard size window and
maximizing it.


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


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: wx.Frame - Maximize() not maximizing completely

Vlastimil Brom
2008/4/8, Robin Dunn <[hidden email]>:
Vlastimil Brom wrote:

If Maximize() is called  before Show(1), the window gets allmost maximized, however, there remains some space ...

I expect that it is simply something like a lack of a size event at the maximized size, so the layout isn't resizing the child widget to the final size.  Try adding a call to frm.Layout(). ...

Thank you very much Robin,
calling  frm.Layout() after frm.Show() fixes the Maximize problem in the sample application; after some trials I found the solution of the same problem in my aui app too - here  frm._mgr.Update() must be called after Show().

Thanks again,
              Vlasta

Loading...