Search code examples
pythonkivykivy-languagekivymd

KIVY - Rotate the whole Layout


I would like to ask if is even possible to rotate whole Layout in Kivy (including its functionality).

I need to have designed one Layout but I need to create an app with splited screen horizontally and use that Layout on bottom side normaly, but on the top side rotated by 180° (upside down)...

The problem is that even it looks good, the functionality on the up side (which is upside down) still stays normal (in this case: When I click on Button 2 the Button 1 is clicked and vice versa - that's bad... 😕)

Layout example

My code for Kivy is here:

BoxLayout:
    orientation: "vertical"

    BoxLayout:
        canvas.before:
            PushMatrix
            Rotate:
                angle: 180
                origin: self.center
        canvas.after:
            PopMatrix
        Test:

    Test:

<Test@BoxLayout>:
    Button:
        text: "Button 1"
    Button:
        text: "Button 2"

Please, could You somebody give some advice how to solve it?

Thank You a lot. 😉


Solution

  • OK.

    Thank to all of You but I've solved it by myself? 😁

    Sorry for this topic but if would somebody interested, the solution is in the using of another Layout ('ScatterLayout'). 😉

    Here is the solution:

    BoxLayout:
        orientation: "vertical"
    
        BoxLayout:
            Test:
                rotation: 180
    
        Test:
    
    <Test@ScatterLayout>:
        BoxLayout:
            Button:
                text: "Button 1"
            Button:
                text: "Button 2"