简体   繁体   中英

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... )

布局示例

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.

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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM