如果用户正确键入屏幕上的内容,我就会拥有这段代码。
-keep class com.google.android.gms.** { *; }
-dontwarn com.google.android.gms.**
我想知道如果他们不键入屏幕上的内容,如何阻止这段代码运行:
words = ["Games","Development","Keyboard","Speed","Typer","Anything","Alpha","Zealous","Accurate","Basics","Shortcut","Purpose","Window","Counter","Fortress","Modification","Computer","Science","History","Football","Basketball","Solid","Phantom","Battlefield","Advanced","Warfare","Download","Upload","Antidisestablishmentarianism","Supercalifragilisticexpialidocious","Discomobobulation","Liberated","Assassin","Brotherhood","Revelation","Unity","Syndicate","Victory"]
wordcount = 0
maxwords = 12
skips = 0
def nextWord():
global score
global wordcount
global skips
global maxwords
global name
global high_score
entry.focus_set()
if entry.get().lower() == words[1].lower():
score += 1
wordcount += 1
wordcounter.config(text="Words: " + str(wordcount))
即使因为以下原因而未正确输入,它仍会继续:
for i in range(maxwords):
entry.delete(0, tkinter.END)
random.shuffle(words)
label.config(text=str(words[1]))
scoreLabel.config(text="Time: " + str(score)+ "s")
我目前有这个:
def startGame(event):
nextWord()
root.bind("<Return>", startGame)
目前的做法是制作
elif entry.get().lower() != words[1].lower():
wronglabel.config(text="WRONG!")
time.sleep(0.6)
wronglabel.delete(0, tkinter.END)
说错了但我想知道如果用户没有输入正确的单词,如何使其不随机随机播放并从列表中获取项目。 感谢。
总之,这使得:(仅发布相关代码):
wronglabel = tkinter.Label(root, text="", font =("Helvetica, 14"))
wronglabel.pack()
(我在代码中编辑了一些小问题来解决另一个问题)
答案 0 :(得分:0)
我可能只是没有正确理解这一点,但是你不能像这样在if语句中移动for循环吗?
if entry.get().lower() == words[1].lower():
score += 1
wordcount += 1
wordcounter.config(text="Words: " + str(wordcount))
for i in words[len(maxwords)]:
entry.delete(0, tkinter.END)
random.shuffle(words)
label.config(text=str(words[1]))
scoreLabel.config(text="Time: " + str(score)+ "s")