wxPython: Making a frame be on top of everything

妖精的绣舞 提交于 2019-12-23 18:13:05

问题


I want my frame to be always on top, but I want it to be really on top. I want no other windows to hide it, even if they are also "always on top". I'm using wx.STAY_ON_TOP and wx.FRAME_FLOAT_ON_PARENT, but still there are windows that appear on top of mine. Also, the taskbar appears on top of my frame, while I'd like it to be behind my frame.

I've tried a lot of things that didn't work, detailed here.

Any idea how to make my frame really on top?


回答1:


Because their is no standard method in doing so, as it is most often an undesired effect, you can possibly achieve this by frequently setting the topmost flag again to "overrule" any other applications going for the topmost position. You could do this using a timer which sets the value every x ms, or you can try and only set the ontop flag again when the window has lost focus. The events to set the ontop flag are:

EVT_SET_FOCUS 
EVT_KILL_FOCUS 



回答2:


Try using this:

wx.Frame.SetFocus()


来源:https://stackoverflow.com/questions/12497482/wxpython-making-a-frame-be-on-top-of-everything

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!