Created
August 9, 2010 19:42
-
-
Save berinhard/515969 to your computer and use it in GitHub Desktop.
A short decorator used to clean main loop functions. I use it in my pygame projects.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def main_loop(f): | |
| def func(): | |
| while True: | |
| f() | |
| return func | |
| @main_loop | |
| def main_loop_function(): | |
| print "Whoooo! I'm in loop!" | |
| main_loop_function() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment