固定Kivy程序的窗口大小

固定Kivy程序的窗口大小

本文介绍了固定Kivy程序的窗口大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以保持Kivy程序的窗口大小固定吗?在固定的意义上,不能增加或减小其窗口大小.例如,我想要一个窗口大小为500x500的Kivy程序,而最终用户不能更改窗口大小或将其变成全屏显示.我尝试将高度,宽度,minimum_height和minimum_width设置为相同的值,但仍然可以更改窗口大小并全屏显示.

Is there any way to keep the window size for Kivy programs fixed? Fixed in the sense its window size cannot be increased or decreased. For example, I want a Kivy program whose window size is 500x500 and the end user cannot either change the window size or turn it into fullscreen. I tried setting the height, width, minimum_height and minimum_width all with same values and still I can change window size and fullscreen it.

推荐答案

有一种方法可以将应用配置为禁用调整大小

There is a way to configure the app to disable resizing

from kivy.config import Config
Config.set('graphics', 'resizable', False)

此外,可以使用相同的方法来设置窗口的默认宽度-高度.
记住一点.在您的应用程序开始时像这样进行操作,它将仅保留该应用程序的设置.但是,如果随后运行Config.write(),则会将设置保存在配置文件中.

Also, the same way you can set the default width-height of the window.
Keep something in mind. Doing it like that in the beginning of your app, it will keep the settings only for that app. However, if you then run a Config.write(), you'll save the settings in a configuration file.

请阅读这篇 Wiki文章以了解更多信息.

Read this wiki article for more info.

这篇关于固定Kivy程序的窗口大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-01 15:38