Clear canvas the right way

This commit is contained in:
Ian Jauslin 2021-10-20 00:37:09 -04:00
parent e650923bc7
commit 89a3974626
3 changed files with 2 additions and 3 deletions

View File

@ -41,6 +41,7 @@ class Command_prompt(Label):
def draw(self): def draw(self):
self.canvas.before.clear()
# background # background
with self.canvas.before: with self.canvas.before:

View File

@ -226,12 +226,12 @@ class Cross_painter(Widget):
def reset(self): def reset(self):
self.crosses=[] self.crosses=[]
self.selected=None self.selected=None
self.canvas.clear()
self.draw() self.draw()
# draw all crosses # draw all crosses
def draw(self): def draw(self):
self.canvas.clear()
with self.canvas: with self.canvas:
for cross in self.crosses: for cross in self.crosses:
cross.draw() cross.draw()
@ -270,7 +270,6 @@ class Cross_painter(Widget):
if touch.button=="left" and self.selected!=None: if touch.button=="left" and self.selected!=None:
self.selected.pos=self.check_move(Point(touch.x/Cross.size,touch.y/Cross.size),self.selected) self.selected.pos=self.check_move(Point(touch.x/Cross.size,touch.y/Cross.size),self.selected)
# redraw # redraw
self.canvas.clear()
self.draw() self.draw()

View File

@ -39,6 +39,5 @@ class Status_bar(Label):
if self.app.readonly: if self.app.readonly:
self.raw_text+=" [RO]" self.raw_text+=" [RO]"
# do not wrap # do not wrap
self.text=self.raw_text[:min(len(self.raw_text),int(self.width/self.char_width))] self.text=self.raw_text[:min(len(self.raw_text),int(self.width/self.char_width))]