예제 #1
0
 def _init_game(self):
     # self.board = AnchorLayout(anchor_x='center', anchor_y='center')
     self.board = Board(self)  # , size_hint=(None, None), size=(int(350), int(350)))
     # self.board.add_widget(board)
     self.add_widget(self.board)
     self.help = TextInput(
         readonly=True,
         cursor_color=(0, 0, 0, 0),
         background_color=(0, 0, 0, 1),
         foreground_color=(1, 0, 0, 1),
         text=self.board.room.say())
     w = Widget()
     b = Button()
     w.walk()
     self.settings = Settings(self.music)
     self.add_widget(self.help)
     self.add_widget(self.settings)
예제 #2
0
def get_children_index(parent: Widget, child: Widget) -> Optional[int]:
    """
  Returns the index of child in the list of parent's children widgets, in the
  order in which the widgets are drawn. Index 0 is the parent itself; the parent
  is the first widget to be drawn (in z-order).
  """
    for index, widget in enumerate(parent.walk(restrict=True, loopback=False)):
        if widget is child:
            return index
    return None