IM试图造成一个循环,迫使用户在输入框中输入一定的数字。如果他们没有输入正确的数字,则循环应重新出现,让他们继续尝试直到用户插入20。当前该框会一遍又一遍地闪烁,如果用户未选择20,则用户将无法再次输入任何内容。第一次。
BankBoxEntry2 = g.Entry(g.Point(200,75), 4)
BankBoxEntry2.draw(win)
win.getMouse()
myText7.setText("")
Bankmessage = int (BankBoxEntry2.getText())
while Bankmessage != 20 :
scaredBankText =g.Text(g.Point(200,25),'The street game buy in is $20 \n this is not enough money')
scaredBankText.draw(win)
BankBoxEntry2.undraw()
BankBoxEntry2 = g.Entry(g.Point(200,75), 4)
BankBoxEntry2.draw(win)
Bankmessage = int (BankBoxEntry2.getText())
if Bankmessage == 20 :
myBankText =g.Text(g.Point(200,25),'Lets go to the street game!!!')
myBankText.draw(win)