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.
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.
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.
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.
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 usingConfig.set
thenConfig.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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With