问题将 Kivy 设置为全屏

2023-06-07Python开发问题
55

本文介绍了问题将 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 设置为全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

在xarray中按单个维度的多个坐标分组
groupby multiple coords along a single dimension in xarray(在xarray中按单个维度的多个坐标分组)...
2024-08-22 Python开发问题
15

Pandas中的GROUP BY AND SUM不丢失列
Group by and Sum in Pandas without losing columns(Pandas中的GROUP BY AND SUM不丢失列)...
2024-08-22 Python开发问题
17

GROUP BY+新列+基于条件的前一行抓取值
Group by + New Column + Grab value former row based on conditionals(GROUP BY+新列+基于条件的前一行抓取值)...
2024-08-22 Python开发问题
18

PANDA中的Groupby算法和插值算法
Groupby and interpolate in Pandas(PANDA中的Groupby算法和插值算法)...
2024-08-22 Python开发问题
11

PANAS-基于列对行进行分组,并将NaN替换为非空值
Pandas - Group Rows based on a column and replace NaN with non-null values(PANAS-基于列对行进行分组,并将NaN替换为非空值)...
2024-08-22 Python开发问题
10

按10分钟间隔对 pandas 数据帧进行分组
Grouping pandas DataFrame by 10 minute intervals(按10分钟间隔对 pandas 数据帧进行分组)...
2024-08-22 Python开发问题
11