Search code examples
python-3.xpygamefullscreenkivypython-3.4

How do I turn off fullscreen in Kivy?


All Kivy (1.8.0) applications run fullscreen on my PC by default. I need to turn fullscreen off for only one (not for each) Kivy application. Strange, but I haven't found the answer for this simple question. Probably, that's not Kivy, but Pygame, but anyway I don't know how to trun it off. Kivy and Pygame were taken from here.


Solution

  • You can configure the way window will be displayed using kivy.config.Config before importing any Kivy module. For example, to have fullscreen application (this shouldn't be enabled by default):

    from kivy.config import Config
    Config.set('graphics', 'fullscreen', 'auto')
    

    In your case you can try to set it explicitly:

    #!/usr/bin/python
    # -*- coding: utf-8 -*-
    
    from kivy.config import Config
    Config.set('graphics', 'fullscreen', '0')
    
    from kivy.app import App
    
    class TestApp(App):
        pass
    
    if __name__ == '__main__':
        TestApp().run()
    

    You can find details about graphics:fullscreen option in documentation.