root/walk.py

Revision 1, 346 bytes (checked in by root, 3 years ago)

Initial commit

Line 
1import thread
2import time
3
4orient = 1
5
6def 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
17def fun2(w):
18    while(True):
19        fun(w)
20        time.sleep(.1)
21
22def start(w):
23    thread.start_new_thread(fun2, (w,))
Note: See TracBrowser for help on using the browser.