Skip to content Skip to sidebar Skip to footer

Forcing A Kivy Widget's Orientation To Be Landscape/portrait

I'm developing an app where I want one of ScreenManager's screen to be in landscape orientation. I don't want it to change to vertical by itself. As of now, what I learned is only

Solution 1:

You can place a content of the screen on a scatter layout, and then rotate it:

test.kv:

ScreenManager:Screen:name:'normal'GridScreen:name:'flipped'ScatterLayout:do_rotation:Falsedo_scale:Falsedo_translation:Falserotation:90pos_hint: {'center_x':0.5, 'center_y':0.5}
            size_hint:None,Nonesize:root.height,root.widthGrid<Grid@GridLayout>:cols:1Button:text:'normal'on_press:app.root.current='normal'Button:text:'flipped'on_press:app.root.current='flipped'

main.py:

#!/usr/bin/env python2# -*- coding: utf-8 -*-from kivy.app import App


classTest(App):
    pass


Test().run()

@edit There is also plyer's Orientation.

Post a Comment for "Forcing A Kivy Widget's Orientation To Be Landscape/portrait"