问题描述
我正在尝试编写一个在全屏模式下运行kivy的应用程序.但这是我的问题:
I'm trying to write an application that runs kivy at full screen. But these are my issues:
1)当我运行命令时:
1) When I run the command:
#Config.set('graphics', 'fullscreen', 1)
然后,猕猴桃似乎要全时运转,但是窗口的背景图像周围有很多黑色空间.即使我拉长图像,奇异果也会在显示图像时将其剪切.
Then kivy appears to go full time, but the window has a lot of black spaces around the background image. Even if I elongate the image, kivy just cuts the image when showing it.
2)当我运行此命令来将窗口大小设置为我的屏幕大小时:
2) When I run this command to set the window size to the size of my screen:
Config.set('graphics', 'width', '1366')
Config.set('graphics', 'height', '768')
这种方式实际上给我的效果比全屏效果更好,但是kivy返回的高度参数仅为715,而不是768,这是我告诉kivy使用的值(如您所见)在上面的Config.set()函数中).
This way actually gives me a better result than full screen, but kivy returns a height parameter of only 715 instead of the 768, which is the value I told kivy to use (as you can see in the Config.set() function above).
我的屏幕分辨率是1366x768
My screen resolution is 1366x768
如何解决此问题并使我的kivy应用真正进入全屏显示?
How can I solve this issue and make my kivy app go real full screen?
非常感谢
推荐答案
尝试
from kivy.core.window import Window
Window.fullscreen = True
在使用App.run()
方法之前执行此操作,它应该切换到全屏模式.
Do this before you App.run()
method, and it should switch to fullscreen mode.
欢呼
这篇关于将Kivy设置为全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!