python - wx.EVT_MAXIMIZE prevented exiting full screen -


i have frame 1 radio box toggle full screen. frame go full screen when user clicks maximize button. however, if use maximize button, radio box fail restore window. if use radio box go full screen, able restore window.

import wx   class fswindow(wx.frame):   def __init__(self, *args, **kwargs):   wx.frame.__init__(self, *args, **kwargs)   self.setsize((800, 600))   self.radiofullscreen = wx.radiobox(self, -1, "display", choices=["windowed","full screen"])   self.radiofullscreen.bind(wx.evt_radiobox, self.fs)   self.bind(wx.evt_maximize, self.onmaximize)   self.sizer = none   self.show()  def fs(self, event):   if self.radiofullscreen.getselection():     self.showfullscreen(true)   else:     self.showfullscreen(false)  def onmaximize(self, event):   self.showfullscreen(true) # <-- add self.restore() or self.maximize(false) here   self.radiofullscreen.setselection(1)   app = wx.app() frame =fswindow(none, -1, "mainwindow") app.mainloop() 

however, if add self.restore() or self.maximize(false) before self.showfullscreen(true) commented on source code above, radio buttons work. problem is, window restored first before going full screen ugly. solution this? please explain why happened, if possible.

running python 2.7.9, wxpython 3.0.2 on window 7 professional 32-bit

it seems showfullscreen not setting flag, things out of sync.

if use maximize/restore things work fine me, i.e. following changes code.

def fs(self, event):     if self.radiofullscreen.getselection():         self.maximize()         #self.showfullscreen(true, style=wx.fullscreen_all)         print('done fs true')     else:         #self.showfullscreen(false, style=wx.fullscreen_all)         self.restore()         print('done fs false')   def onmaximize(self, event):     event.skip()     self.radiofullscreen.setselection(1)     print('done max') 

if don't want menu bar etc when screen maximized uncomment showfullscreen lines.

you handling event "maximize", of time want default behaviour happen, why added event.skip onmaximize handler - in case doesn't make difference looks event fired after maximisation done.


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -