In [1]:
from draw import *
In [11]:
r = Rect(100, 100, fill="#000")
In [12]:
c = Canvas()
In [13]:
c.add(r)
In [14]:
c.show()
In [15]:
c = Canvas()
r = Rect(100, 100, fill="#000")
c.add(r)
from math import pi, sin, cos
def func(i):
r.x(100+100*cos(i/5.))
r.y(100+100*sin(i/5.))
c.loop(func)
c.show()
In [ ]:
c.stop = True
In [ ]:
class N():
def __init__(self):
return
def hoge(self):
print "hogehoge"
n = N()
for attr in dir(n):
if callable(getattr(n, str(attr))):
def func(*args):
print "updated"
setattr(n, str(attr), func)
In [ ]:
n.hoge()