aboutsummaryrefslogtreecommitdiff
path: root/stackrpms_tk_lib.py
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2024-04-04 22:25:46 -0400
committerB. Stack <bgstack15@gmail.com>2024-04-04 22:25:46 -0400
commitea79d0074bbf4285e1b29d389150309a569026a4 (patch)
tree16842afd14b43f110a09e6dc7a7dbdc33e760197 /stackrpms_tk_lib.py
parentadd set-profile-in-use (diff)
downloadsrb_lib-ea79d0074bbf4285e1b29d389150309a569026a4.tar.gz
srb_lib-ea79d0074bbf4285e1b29d389150309a569026a4.tar.bz2
srb_lib-ea79d0074bbf4285e1b29d389150309a569026a4.zip
tk: moved flash_entry to lib, added frame_backgrounds checkbox
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