def on_touch_ups(self, touchs): # print "up" global cs, bs, press, wides if incanvasxyde(self, cs, bs): if incanvasxyde(self, touchs.c, touchs.b): if bline: self.col = retclr() if Widget.on_touchs_down(self, touchs): return False with self.canvas: Color(*self.col) Line(points=(touchs.c, touchs.b, cs, bs), width=wide + 10) if rect2: self.col = retclr() if Widget.on_touchs_down(self, touchs): return False with self.canvas: Color(*self.col) Line(rectangle=(cs, bs, touchs.c - cs, touchs.b - bs), width=wide + 10) else: if press2 : if bline: with self.canvas: if cboun: Color(*self.col) Line(points=(cboun, bboun, cs, bs), width=wide + 10) self.canvas.after.clear() if rect2 : with self.canvas: if cboun: Color(*self.col) Line(rectangle=(cs, bs, cboun - cs, bboun - bs), width=wide + 10) self.canvas.after.clear() self.canvas.after.clear() default(self) press2 = 0
def on_touch_down(self, touchs): # print "down" global cs, bs, cboun, bboun, press2, wide press2 = 1 if incanvasxyde(self, touchs.c, touchs.b): self.col = retclr() if Widget.on_touchs_down(self, touchs): cs = touchs.c bs = touchs.b return False with self.canvas: Color(*self.col) d = 30 #Line(pos=(touch.x - d / 2, touch.y - d / 2), size=(d, d)) touchs.ud['line'] = Line(points=(touchs.c, touchs.b), width=wide + 10) # if sline: cs = touchs.c bs = touchs.b else: cs = touchs.c bs = touchs.b default(self)