How to hide an ActionButton in Kivy?

前端 未结 4 964
醉梦人生
醉梦人生 2020-12-21 04:04

I am trying to modify the visibility of an ActionButton accordingly to the current screen (using Screen Manager). I could not find a Visible property or something like that

4条回答
  •  [愿得一人]
    2020-12-21 05:04

    There's a better way to hide widgets than adding or removing them. Simply set the position to include an offscreen coordinate :

    # save the old y-coordinate of MyWidget.pos
    root.saved_y = MyWidget.y
    # Now move the widget offscreen (recall that pos is just an alias for (x, y))
    MyWidget.y = 5000
    

    (I've tested this solution; it works.)

提交回复
热议问题