我希望在用户点击它时控制TextField
窗口小部件。如何实现focusNode
属性?说明中没有详细解释。
答案 0 :(得分:2)
OrcHealth = 15
while ((OrcHealth <=0)) or ((Action != 0)):
if Action == 1:
HeroAttack=random.randint(1,5)
OrcHealth = OrcHealth - HeroAttack
print("You see an opening, this is your chance! You swing your blade and do",HeroAttack,"to the orc.\n This brings the beast down to", OrcHealth)
Action = int(input("You grip your sword tightly and think about what to do next.")
else:
print("The battle is over.")
答案 1 :(得分:1)
别忘了以后将其丢弃,以避免内存泄漏:
@override
void dispose() {
focusNode.dispose();
super.dispose();
}