简体   繁体   中英

How can I unmaximize programmatically a maximized frame in wxPython?

Let's say I have a simple application such as the following:

import wx

app = wx.App()

frame = wx.Frame(None, -1, 'This is the frame title')
frame.Show()
frame.Maximize()    

app.MainLoop()

Is there a method I can call on the frame to un-maximize it? I have tried frame.Unmaximize() and frame.Maximize(False) but the former is undefined , while the latter seems to 'fail' silently in Ubuntu.

Here it says that Maximize(False) is the way to go. Is there a bug I should submit, or is there something else I miss here?

Just tried this program under OSX, Win7 and Ubuntu:

import wx

app = wx.App()

frame = wx.Frame(None, -1, 'This is the frame title')
frame.Show()
frame.Maximize() 
frame.Maximize(False)   

app.MainLoop()

On OSX and Win7 the frame visibly maximises then minimises.

On Ubuntu (wxpython 2.8.11 gtk-unicode), the Maximise commands appear completely ignored. I can delete the Maximize(False) line and the frame still isn't maximised.

This is with xfwm4 on Ubuntu 11.10

Looks like a bug to me. But it may also be a window manager quirk.


Amusingly, google finds a bug report where Frame.Maximize() works only on windows. But it is 11 years old. Maybe Linux has not been added yet :)

You could also try Restore() . While under MSW and OS X it's exactly the same as Maximize(false) , in wxGTK it's implemented slightly differently, so perhaps it works even under Ubuntu.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM