当前位置:网站首页>Kivy tutorial of setting the size and background of the form (tutorial includes source code)

Kivy tutorial of setting the size and background of the form (tutorial includes source code)

2022-07-07 04:29:00 Knowledge fatness

Running effect

kivy Tutorial of setting form size and background

Window size

Usually, the application that adjusts the properties of the desktop is the window size . The following changes have absolutely no impact on mobile devices .

It also allows users to display , By our default . To allocate the initial window size , Please insert the next code snippet directly above the read line from kivy.core.window import Window.Window It is important to apply these settings before importing objects ; otherwise , They will have no effect :

from kivy.config import Config

Config.set('graphics', 'width', '960')
Config.set('graphics', 'height', '540')  # 16:9

Besides , You may want to disable window resizing by adding this line :

Config.set('graphics', 'resizable', '0')

Please, unless you have a good reason , Otherwise don't do this , Because it is usually a bad idea to keep these trivial custom settings away from users , And it is easy to destroy the overall user experience . It's tempting to build pixel perfect applications at one resolution , But many of your customers ( Especially mobile users ) Not happy . On the other hand ,Kivy Layout makes it acceptable to build an extensible interface .

Project completion source code

from kivy.app import App
from kivy.base 
原网站

版权声明
本文为[Knowledge fatness]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/188/202207062145112292.html