wxPython:退出全屏
要以全屏模式显示 wxPython 窗口,您可以使用:
ShowFullScreen(True)
How do you get out of full screen while?我尝试过明显的方法:
ShowFullScreen(True)
sleep(5)
ShowFullScreen(False)
但这不起作用。当我运行脚本时,什么也没有出现。 5 秒后,屏幕左上角会出现一个大约 200x250 的窗口,其中没有任何内容。它似乎也没有任何边界。
如果我将其更改为
showFullScreen(True)
,那么我就会陷入全屏窗口,我必须使用 Alt + F2 -> xkill 才能退出。
To display a wxPython window in full screen mode you use:
ShowFullScreen(True)
How do you get out of full screen though? I've tried the obvious way:
ShowFullScreen(True)
sleep(5)
ShowFullScreen(False)
This doesn't work though. When I run the script, nothing appears. After 5 seconds a window roughly 200x250 appears in the top-left corner of the screen, without anything inside of it. It doesn't appear to have any borders either.
If I change this to
showFullScreen(True)
then I get stuck with a full screen window that I have to use Alt + F2 -> xkill to get out of.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来您需要先
Show()
窗口。 (根据 文档,您不必这样做。也许这是一个bug。)我在 Mac OS X 和 Windows 上进行了测试 - 如果您不先调用Show()
,它们都会出现问题。另请注意,您不应该在主 GUI 线程中休眠。您将挂起 UI。使用 CallLater 是一种潜在的解决方案,如我的示例所示。
工作示例:
It looks like you need to
Show()
the window first. (According to the documentation, you shouldn't have to. Maybe this is a bug.) I tested on Mac OS X and Windows - they both exhibit issues if you don't callShow()
first.Also note that you shouldn't sleep in the main GUI thread. You'll hang the UI. Using
CallLater
is one potential solution, as shown in my example.Working example:
ShowFullScreen 的文档如下:
ShowFullScreen(show, style=wx.FULLSCREEN_ALL)
因此,将全屏切换事件放入菜单中并使用以下命令启动全屏模式:
self.window.ShowFullScreen(True, style=(wx.FULLSCREEN_NOTOOLBAR | wx.FULLSCREEN_NOSTATUSBAR |wx.FULLSCREEN_NOBORDER |wx.FULLSCREEN_NOCAPTION))
注意,我省略了wx.FULLSCREEN_NOMENUBAR,这样你仍然会能够访问菜单以再次关闭全屏模式。
The documentation for ShowFullScreen reads:
ShowFullScreen(show, style=wx.FULLSCREEN_ALL)
So put your Full Screen toggle event/s in a Menu and start full screen mode with:
self.window.ShowFullScreen(True, style=(wx.FULLSCREEN_NOTOOLBAR | wx.FULLSCREEN_NOSTATUSBAR |wx.FULLSCREEN_NOBORDER |wx.FULLSCREEN_NOCAPTION))
Note that I omitted wx.FULLSCREEN_NOMENUBAR, in this way you will still be able to access the menu to turn full screen mode off again.