pygui simplify show/hiding annotations

This commit is contained in:
Blake Harnden 2020-04-19 15:57:59 -07:00
parent d26c4fc4ab
commit 3233d8ab58
5 changed files with 17 additions and 28 deletions

View file

@ -80,12 +80,12 @@ class Shape:
self.y1,
self.x2,
self.y2,
tags=tags.SHAPE,
tags=(tags.SHAPE, tags.ANNOTATION),
dash=dash,
fill=self.shape_data.fill_color,
outline=self.shape_data.border_color,
width=self.shape_data.border_width,
state=self.canvas.show_shapes.state(),
state=self.canvas.show_annotations.state(),
)
self.draw_shape_text()
elif self.shape_type == ShapeType.RECTANGLE:
@ -94,12 +94,12 @@ class Shape:
self.y1,
self.x2,
self.y2,
tags=tags.SHAPE,
tags=(tags.SHAPE, tags.ANNOTATION),
dash=dash,
fill=self.shape_data.fill_color,
outline=self.shape_data.border_color,
width=self.shape_data.border_width,
state=self.canvas.show_shapes.state(),
state=self.canvas.show_annotations.state(),
)
self.draw_shape_text()
elif self.shape_type == ShapeType.TEXT:
@ -107,11 +107,11 @@ class Shape:
self.id = self.canvas.create_text(
self.x1,
self.y1,
tags=tags.SHAPE_TEXT,
tags=(tags.SHAPE_TEXT, tags.ANNOTATION),
text=self.shape_data.text,
fill=self.shape_data.text_color,
font=font,
state=self.canvas.show_shapes.state(),
state=self.canvas.show_annotations.state(),
)
else:
logging.error("unknown shape type: %s", self.shape_type)
@ -135,11 +135,11 @@ class Shape:
self.text_id = self.canvas.create_text(
x,
y,
tags=tags.SHAPE_TEXT,
tags=(tags.SHAPE_TEXT, tags.ANNOTATION),
text=self.shape_data.text,
fill=self.shape_data.text_color,
font=font,
state=self.canvas.show_shape_labels.state(),
state=self.canvas.show_annotations.state(),
)
def shape_motion(self, x1: float, y1: float):