Issue setting Kivy to fullscreen(问题将 Kivy 设置为全屏)
问题描述
我正在尝试编写一个全屏运行 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 设置为全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:问题将 Kivy 设置为全屏
基础教程推荐
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
- 将 x 轴刻度更改为自定义字符串 2022-01-01
- 尝试制作WhatsApp机器人 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
- 用 Python 编写 Fortran 无格式文件 2022-01-01
- Discord.py 缺少必需的参数 2022-01-01
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
