aboutsummaryrefslogtreecommitdiff
path: root/stackrpms_tk_lib.py
diff options
context:
space:
mode:
Diffstat (limited to 'stackrpms_tk_lib.py')
-rwxr-xr-xstackrpms_tk_lib.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/stackrpms_tk_lib.py b/stackrpms_tk_lib.py
index a086344..e106aae 100755
--- a/stackrpms_tk_lib.py
+++ b/stackrpms_tk_lib.py
@@ -12,6 +12,7 @@
# https://coderslegacy.com/python/create-a-status-bar-in-tkinter/
# https://stackoverflow.com/questions/38329996/enable-mouse-wheel-in-spinbox-tk-python
# https://insolor.github.io/effbot-tkinterbook-archive/tkinter-events-and-bindings.htm
+# https://stackoverflow.com/questions/27533244/how-to-make-a-flashing-text-box-in-tkinter/78277443#78277443
# Improve:
from tkinter import *
from tkinter import Spinbox as tkSpinbox, Checkbutton as tkCheckbutton, Entry as tkEntry, Radiobutton as tkRadiobutton
@@ -440,3 +441,15 @@ class Radiobutton(tkRadiobutton):
if i1 == self.__var.get():
i.focus()
break
+
+def flash_entry(this_entry, colorlist, ms = 1000):
+ """
+ Flash the offending entry box through the colorlist, one color every 'ms' milliseconds.
+ Example:
+ flash_entry(entry_that_was_invalid,["red","white"])
+ """
+ thiscolor = colorlist.pop(0)
+ this_entry.config(background = thiscolor)
+ if len(colorlist) > 0:
+ top = this_entry._nametowidget(this_entry.winfo_parent())
+ top.after(ms, lambda te=this_entry, c=colorlist, ms=ms: flash_entry(te,c,ms))
bgstack15