Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fixed window size for Kivy programs

Tags:

python

kivy

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.

like image 623
Parthib Biswas Avatar asked May 11 '16 13:05

Parthib Biswas


People also ask

How do I create a window in KIVY Python?

we create the instance of the specific App() class, when we are ready to start, we call the instance App(). run() method. Here the build() method “Initializes the application; it will be called only once. If this method returns a widget (tree), it will be used as the root widget and added to the window.

How do I use KIVY app on Windows?

Mine is a windows 7 pc. To achieve this I did the following : I downloaded the package file from https://pypi.python.org/pypi/Kivy#downloads. Then I opened the package using win rar and pasted the contents to my python27/lib folder.

What is canvas KIVY?

The Canvas is the root object used for drawing by a Widget. A kivy canvas is not the place where you paint. Each Widget in Kivy already has a Canvas by default. When you create a widget, you can create all the instructions needed for drawing.


1 Answers

There is a way to configure the app to disable resizing

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

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.

Config.set should be used before importing any other Kivy modules. Ideally, this means setting them right at the start of your main.py script. Alternatively, you can save these settings permanently using Config.set then Config.write. In this case, you will need to restart the app for the changes to take effect. Note that this approach will effect all Kivy apps system wide.

Read this wiki article for more info.

like image 179
illright Avatar answered Sep 18 '22 08:09

illright