From cf98234f9aa0c7e1ac1515a62ce3d0789afcd485 Mon Sep 17 00:00:00 2001 From: Jonathan Harris Date: Wed, 12 Apr 2017 01:44:08 +0100 Subject: [PATCH] Maintain custom colours when changing state --- ttkHyperlinkLabel.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ttkHyperlinkLabel.py b/ttkHyperlinkLabel.py index 7c2fe0bb..be2e10fc 100644 --- a/ttkHyperlinkLabel.py +++ b/ttkHyperlinkLabel.py @@ -78,6 +78,11 @@ class HyperlinkLabel(platform == 'darwin' and tk.Label or ttk.Label, object): # Change cursor and appearance depending on state and text def configure(self, cnf=None, **kw): + # This class' state + for thing in ['url', 'popup_copy', 'underline', 'foreground', 'disabledforeground']: + if thing in kw: + setattr(self, thing, kw[thing]) + if kw.get('state') == tk.DISABLED: if 'foreground' not in kw: kw['foreground'] = self.disabledforeground