how do you change the canvas or window size of an app using kivy

后端 未结 3 1248
[愿得一人]
[愿得一人] 2021-01-18 04:38

How do you change the size of a window using Kivy. I\'ve been searching around and am able to change pretty much everything except the size of the window that things go into

相关标签:
3条回答
  • 2021-01-18 04:54

    Don't use

    from kivy.core.window import Window
    

    which makes these not work

    Config.set('graphics', 'width', '200')
    Config.set('graphics', 'height', '400')
    
    0 讨论(0)
  • 2021-01-18 05:02

    To manage window config you can use the import from kivy.config import Config on top of source file.

    from kivy.config import Config
    Config.set('graphics', 'resizable', '0')
    Config.set('graphics', 'width', '640')
    Config.set('graphics', 'height', '480')
    
    0 讨论(0)
  • 2021-01-18 05:21

    No, the size cannot be set in kv. You can set it using Config as you do above, or you can change the window size later by setting the size on the Window object:

    from kivy.core.window import Window
    Window.size = (640, 1163)
    
    0 讨论(0)
提交回复
热议问题