root/walk.py
| Revision 1, 346 bytes (checked in by root, 1 year ago) |
|---|
| Line | |
|---|---|
| 1 | import thread |
| 2 | import time |
| 3 | |
| 4 | orient = 1 |
| 5 | |
| 6 | def fun(w): |
| 7 | global orient |
| 8 | if orient > 0: |
| 9 | w.x += 5 |
| 10 | if w.x > 1000: |
| 11 | orient = -1 |
| 12 | else: |
| 13 | w.x -= 5 |
| 14 | if w.x < 0: |
| 15 | orient = 1 |
| 16 | |
| 17 | def fun2(w): |
| 18 | while(True): |
| 19 | fun(w) |
| 20 | time.sleep(.1) |
| 21 | |
| 22 | def start(w): |
| 23 | thread.start_new_thread(fun2, (w,)) |
Note: See TracBrowser for help on using the browser.
