Roman B.
Roman B.

Reputation: 117

How to set minimal window size to kivy application?

I try to set a minimum width and height to my kivy app. I want it resizable with min size restriction.

In the kivy doc I read about WindowBase class which has parameters minimum_height & minimum_width.

WindowBase description: https://kivy.org/doc/stable/api-kivy.core.window.html

How can I set the min size restriction to the basic window which App class creates automatically?

Upvotes: 2

Views: 1425

Answers (1)

eyllanesc
eyllanesc

Reputation: 243897

You have to use the Window object:

from kivy.app import App
from kivy.uix.button import Button
from kivy.core.window import Window

Window.minimum_height = 400
Window.minimum_width = 400


class MyApp(App):
    def build(self):
        return Button(text="Hello World")


if __name__ in ("__android__", "__main__"):
    MyApp().run()

Upvotes: 3

Related Questions