Форум сайта python.su
def __init__(self):
self.im=g.Image.new((360,560))
self.ini_vars()
self.ini_img()
a.app.screen='full'
a.app.directional_pad=False
a.app.orientation='portrait'
self.canvas=a.Canvas(event_callback=self.ev_call, redraw_callback=self.redraw)
a.app.body=self.canvas
def ev_call(self, event):
if not event['type'] in [key_codes.EButton1Up, key_codes.EButton1Down, key_codes.EDrag]:
return
if event['type'] == key_codes.EButton1Down:
if event['pos'][1]>=560:
if self.panel==0:
if event['pos'][0]<=72:
self.panel=1
elif (event['pos'][0]<=144)and(event['pos'][1]>=72):
self.panel=2
elif (event['pos'][0]<=216)and(event['pos'][1]>=144):
self.panel=3
elif (event['pos'][0]<=288)and(event['pos'][1]>=216):
self.panel=4
elif (event['pos'][0]<=360)and(event['pos'][1]>=288):
self.panel=5
self.draw()
elif event['pos'][1]<560:
self.prev_x=event['pos'][0]
self.prev_y=event['pos'][1]
self.im.point((10,10), outline=self.colour, outline=5, width=10, fill=self.colour)
self.draw()
elif event['type'] == key_codes.EDrag:
qw=(self.prev_x, self.prev_y, event['pos'][0], event['pos'][1])
self.im.line(qw , outline=self.colour, outline=5, width=10, fill=self.colour)
self.prev_x=event['pos'][0]
self.prev_y=event['pos'][1]
self.draw()
q=e32.Ao_lock()
q.signal()
Офлайн