![]() |
Python Programming Question
Im sory to ask this because Im still new to Python. but is there such a thing as 'nested While' in Python just like in C++? Im trying to loop a vizard game which contain a 'while true:' loop. the thing is, how do I repeat the whole program. this is the sample programming code.
Code:
def game() So how do we reset the game by using another while loop by pressing the 'r' button ( yield viztask.waitKeyDown('r') ) and back to the beginning. (#<----starts the game) tq:confused: |
There seems to be a problem with your current code. The while loop inside your game task is not yielding. This will probably cause the graphics loop to freeze. It seems like there should be a yield None statement at the end of the loop.
Regarding your original question. You can setup a simple callback function that restarts the game task when the 'r' key is pressed. Example: Code:
def ResetGame(): |
Thanks..especially for the reset function that u suggested.it makes my life easier..
|
All times are GMT -7. The time now is 09:58 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC