問題描述
我正在嘗試編寫一個全屏運行 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)
然后 kivy 似乎全時運行,但窗口的背景圖像周圍有很多黑色空間.即使我拉長了圖像,kivy 也只是在顯示時剪切了圖像.
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 設置為全屏的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!