Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当用户单击“设置”以使所有内容都不可见时,我不知道该怎么做。我试过了
Play.on_click = Settings.visible = False Play.on_click = quit.visible = False Play.on_click = Play.visible = False
但它不起作用
on_click需要一个函数,但您分配了一个值。试试这个:
on_click
def play_onclick(): Settings.visible = False quit.visible = False Play.visible = False Play.on_click = play_onclick # without parentheses!
另外,我假设这Play是一个ursina.Button实例。如果是这种情况,您应该遵循 Python 命名约定,即名称以小写字母开头,即play.
Play
ursina.Button
play