如何在Pygbag中制作全屏模式?
When I open the pygame html page created with pygbag, the console opens in full screen and the pygame window is in the corner: (see image below)
How can I make the pygbag window open in full screen?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简短的答案,您不能,没有用户干预的情况下,没有网络浏览器允许您的代码切换到页面加载的全屏。
因此,现在pygbag中的默认值是“全屏窗口”:这样的方式,PyGame屏幕总是在页面内最大化,这似乎是一个不错的权衡。
要获得控制台,只需将#debug添加到URL中,
但是一旦用户与PyGame进行交互,您可以通过Python调用真实的全屏,并使用相同的代码在台式机上使用。
Short answer, you cannot, no web browser will allow your code to switch to fullscreen on page load without user intervention.
So now the default in pygbag is "fullscreen windowed" : that way pygame screen is always maximized inside the page which seems a good trade off.
To get console back, just add #debug to the url
but once user is -already- interacting with pygame, you can call real full screen via python with same code you would use on desktop.