【问题标题】:KIVY - Rotate the whole LayoutKIVY - 旋转整个布局
【发布时间】:2022-01-13 03:46:50
【问题描述】:

我想问一下是否可以在 Kivy 中旋转整个布局(包括它的功能)。

我需要设计一个布局,但我需要创建一个水平分割屏幕的应用程序,并在底部正常使用该布局,但在顶部旋转 180°(倒置) ...

问题是即使它看起来不错,上面的功能(倒置)仍然保持正常(在这种情况下:当我点击 Button 2 时,Button 1 被点击,反之亦然 - 这很糟糕...... ????)

我的 Kivy 代码在这里:

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"

拜托,有人能给点建议如何解决吗?

非常感谢。 ????

【问题讨论】:

    标签: python kivy kivy-language kivymd


    【解决方案1】:

    好的。

    谢谢大家,但我自己解决了? ?

    很抱歉这个话题,但如果有人感兴趣,解决方案是使用另一个布局('ScatterLayout')。 ?

    解决办法如下:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-22
      • 2012-10-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多