Skip to content
This repository was archived by the owner on Sep 25, 2022. It is now read-only.

Commit c1a2654

Browse files
Merge remote-tracking branch 'origin/master'
2 parents 6fb94f0 + b6dcd23 commit c1a2654

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/field.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ def __init__(self, parent: "Gui", **kwargs):
2828
self.parent = parent
2929
self.scale = 1
3030

31+
self.flashed = False
32+
3133
def build(self):
3234
boundary_select_but = tk.Button(self, text="Set Boundary", bg="#AAA")
3335
boundary_select_but.place(x=self.winfo_width() // 2 - boundary_select_but.winfo_reqwidth() // 2,
@@ -142,13 +144,17 @@ def change_fielder_pos(self, but: "FielderButton", x, y):
142144
but.update_fielder()
143145

144146
def flash_fielder(self, tag):
145-
self.canvas.itemconfig(tag, fill=self.FIELDER_FLASH_COLOR, outline=self.FIELDER_FLASH_COLOR)
146-
coords = self.canvas.coords(tag)
147-
self.canvas.coords(tag, [coords[0] - self.FIELDER_FLASH_SIZE_UP, coords[1] - self.FIELDER_FLASH_SIZE_UP,
148-
coords[2] + self.FIELDER_FLASH_SIZE_UP, coords[3] + self.FIELDER_FLASH_SIZE_UP])
147+
if not self.flashed:
148+
self.canvas.itemconfig(tag, fill=self.FIELDER_FLASH_COLOR, outline=self.FIELDER_FLASH_COLOR)
149+
coords = self.canvas.coords(tag)
150+
self.canvas.coords(tag, [coords[0] - self.FIELDER_FLASH_SIZE_UP, coords[1] - self.FIELDER_FLASH_SIZE_UP,
151+
coords[2] + self.FIELDER_FLASH_SIZE_UP, coords[3] + self.FIELDER_FLASH_SIZE_UP])
152+
self.flashed = True
149153

150154
def unFlash_fielder(self, tag):
151-
self.canvas.itemconfig(tag, fill=self.FIELDER_COLOR, outline=self.FIELDER_COLOR)
152-
coords = self.canvas.coords(tag)
153-
self.canvas.coords(tag, [coords[0] + self.FIELDER_FLASH_SIZE_UP, coords[1] + self.FIELDER_FLASH_SIZE_UP,
154-
coords[2] - self.FIELDER_FLASH_SIZE_UP, coords[3] - self.FIELDER_FLASH_SIZE_UP])
155+
if self.flashed:
156+
self.canvas.itemconfig(tag, fill=self.FIELDER_COLOR, outline=self.FIELDER_COLOR)
157+
coords = self.canvas.coords(tag)
158+
self.canvas.coords(tag, [coords[0] + self.FIELDER_FLASH_SIZE_UP, coords[1] + self.FIELDER_FLASH_SIZE_UP,
159+
coords[2] - self.FIELDER_FLASH_SIZE_UP, coords[3] - self.FIELDER_FLASH_SIZE_UP])
160+
self.flashed = False

0 commit comments

Comments
 (0)