PYTHON,如何退出一段时间?

劳尔·昆扎尼

我是一个刚接触编程和东西的学生,并且正在尝试学习Python。我需要这个循环来保持滚动,直到我单击屏幕

win=GraphWin("game of life", 600, 600)  
win.setCoords(-1,-3,s+1,s+1)


q = True

while q:

       board = iterate(board)

       x = 0

       while(x<s):
             y = 0
             while(y<s):
                      update_color(x ,y ,board ,rec)
                      y = y+1
             x = x+1
       if(win.getMouse()): # i just tried that, but its not working
              q = False

对不起,我的英语不好,这不是我的母语

k

该代码基本上检查用户是否单击了屏幕上的任何位置。

win=GraphWin("game of life", 600, 600)  
win.setCoords(-1,-3,s+1,s+1)


q = True

while q:

       board = iterate(board)

       x = 0

       while(x<s):
             y = 0
             while(y<s):
                      update_color(x ,y ,board ,rec)
                      y = y+1
             x = x+1
       if(win.checkMouse() is not None): #Checks if the user clicked yet
              q = False #Better to use the break statement here

假设http://mcsp.wartburg.edu/zelle/python/graphics/graphics/node2.html是正确的,并且其余代码是好的。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章