mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-12 23:37:14 +03:00
theme.py: Apply .configure() paranoia on button enter/leave
This commit is contained in:
parent
17530c2d2b
commit
520ff5868f
28
theme.py
28
theme.py
@ -195,17 +195,35 @@ class _Theme(object):
|
|||||||
def _enter(self, event, image):
|
def _enter(self, event, image):
|
||||||
widget = event.widget
|
widget = event.widget
|
||||||
if widget and widget['state'] != tk.DISABLED:
|
if widget and widget['state'] != tk.DISABLED:
|
||||||
widget.configure(state=tk.ACTIVE)
|
try:
|
||||||
|
widget.configure(state=tk.ACTIVE)
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
logger.exception(f'Failure setting widget active: {widget=}')
|
||||||
|
|
||||||
if image:
|
if image:
|
||||||
image.configure(foreground=self.current['activeforeground'],
|
try:
|
||||||
background=self.current['activebackground'])
|
image.configure(foreground=self.current['activeforeground'],
|
||||||
|
background=self.current['activebackground'])
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
logger.exception(f'Failure configuring image: {image=}')
|
||||||
|
|
||||||
def _leave(self, event, image):
|
def _leave(self, event, image):
|
||||||
widget = event.widget
|
widget = event.widget
|
||||||
if widget and widget['state'] != tk.DISABLED:
|
if widget and widget['state'] != tk.DISABLED:
|
||||||
widget.configure(state=tk.NORMAL)
|
try:
|
||||||
|
widget.configure(state=tk.NORMAL)
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
logger.exception(f'Failure setting widget normal: {widget=}')
|
||||||
|
|
||||||
if image:
|
if image:
|
||||||
image.configure(foreground=self.current['foreground'], background=self.current['background'])
|
try:
|
||||||
|
image.configure(foreground=self.current['foreground'], background=self.current['background'])
|
||||||
|
|
||||||
|
except Exception:
|
||||||
|
logger.exception(f'Failure configuring image: {image=}')
|
||||||
|
|
||||||
# Set up colors
|
# Set up colors
|
||||||
def _colors(self, root, theme):
|
def _colors(self, root, theme):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user