Fix PySimpleGUI 5.x compatibility issue with theme() method

- Add try/except fallback for sg.theme() -> sg.set_options()
- Resolves AttributeError when using PySimpleGUI 5.0.8.3
- Maintains backward compatibility with PySimpleGUI 4.x
This commit is contained in:
Claude 2026-01-02 20:29:52 +00:00
parent 49d90df3cb
commit 0aad0f80d2
No known key found for this signature in database

12
gui.py
View file

@ -19,7 +19,11 @@ class Dashboard:
bot: Reference to the main bot instance bot: Reference to the main bot instance
""" """
self.bot = bot self.bot = bot
sg.theme('DarkBlue3') # PySimpleGUI 5.x compatibility
try:
sg.theme('DarkBlue3')
except AttributeError:
sg.set_options(theme='DarkBlue3')
# Event queue for thread-safe updates # Event queue for thread-safe updates
self.event_queue = Queue() self.event_queue = Queue()
@ -196,7 +200,11 @@ class SetupWizard:
"""Configuration wizard for first-time setup""" """Configuration wizard for first-time setup"""
def __init__(self): def __init__(self):
sg.theme('DarkBlue3') # PySimpleGUI 5.x compatibility
try:
sg.theme('DarkBlue3')
except AttributeError:
sg.set_options(theme='DarkBlue3')
def run(self): def run(self):
""" """