简体   繁体   中英

Manually trigger a wx.EVT_SIZE event

In order to refresh my GUI, sometimes self.Refresh() , self.Layout() doesn't produce the result I want.

The only thing that worked and really refreshed the GUI is : manually triggering a wx.EVT_SIZE with

s = self.GetSize()
self.SetSize((0,0))
self.SetSize(s)

Is there a cleaner way of manually triggering a wx.EVT_SIZE ?

Use wxWindow::PostSizeEvent() .

Notice, however, that if you avoided the manual handling of wxEVT_SIZE (which you seem to be doing based on your other questions) and just used sizers, then a simple Layout() would be enough.

And, FWIW, Refresh() has nothing to do with size at all, it just results in repainting the window, ie can be used to trigger a call to your wxEVT_PAINT , not wxEVT_SIZE , handler.

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