我是基维的新手。我做了一个井字游戏,但当其中一个玩家获胜时,我希望游戏重新开始,玩家可以再次玩。我该如何在kivy中实现这个呢?或者我应该重置游戏所基于的按钮和列表?我试过很多东西
self.clear_widgets()
但没用
这是main.py
这是提塔托.kv在
<EntryButton>:
obj: obj
id: obj
on_press: root.play()
<TicTable>:
orientation: "vertical"
BoxLayout:
EntryButton:
n:1
text: ""
EntryButton:
n:2
text: ""
EntryButton:
n:3
text:""
BoxLayout:
EntryButton:
n:4
text: ""
EntryButton:
n:5
text: ""
EntryButton:
n:6
text: ""
BoxLayout:
EntryButton:
n:7
text: ""
EntryButton:
n:8
text: ""
EntryButton:
n:9
text: ""
TicTable:
您的
TicTacToeApp
应该具有返回小部件的build
方法。在我给你举个例子,它是一个智力测验应用程序,当正确的按钮被按下(或释放,在kivylang),应用程序将更新它的测验。在
你可以先研究一下,然后为你自己的情况即兴发挥。这样可以吗?在
相关问题 更多 >
编程相关推荐