From e16545a991cebfc95c5a5d8590cfb3c064699464 Mon Sep 17 00:00:00 2001
From: PySimpleGUI <PySimpleGUI@PySimpleGUI.com>
Date: Tue, 3 May 2022 13:30:22 -0400
Subject: [PATCH] Combo element FINALLY gets really nice theme colors all the
 way through!  (Thank you Jason!)

---
 PySimpleGUI.py | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/PySimpleGUI.py b/PySimpleGUI.py
index 3e4ae7b0..2cbe5128 100644
--- a/PySimpleGUI.py
+++ b/PySimpleGUI.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python3
 
-version = __version__ = "4.59.0.37 Released 5-Apr-2022"
+version = __version__ = "4.59.0.38 Released 5-Apr-2022"
 
 _change_log = """
     Changelog since 4.59.0 released to PyPI on 5-Apr-2022
@@ -132,6 +132,9 @@ _change_log = """
     4.59.0.37
         Added back the filetypes parameter availability for the mac for the file browse operations.  Was previously (incorrectly evidently!) removed for FileBrowse operations
             (Thank you resnbl for all the help!)
+    4.59.0.38
+        Combo element finally gets drop-down list formatting (thank you Jason!)
+        
     """
 
 __version__ = version.split()[0]  # For PEP 396 and PEP 345
@@ -15558,6 +15561,7 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
                         combostyle.configure(style_name, arrowcolor=element.button_arrow_color)
                     if element.button_background_color not in (None, COLOR_SYSTEM_DEFAULT):
                         combostyle.configure(style_name, background=element.button_background_color)
+
                 except Exception as e:
                     _error_popup_with_traceback('Combo Element error {}'.format(e),
                                                 'Combo element key: {}'.format(element.Key),
@@ -15570,6 +15574,19 @@ def PackFormIntoFrame(form, containing_frame, toplevel_form):
 
                 element.TKCombo = element.Widget = ttk.Combobox(tk_row_frame, width=width, textvariable=element.TKStringVar, font=font, style=style_name)
 
+                # make tcl call to deal with colors for the drop-down formatting
+                try:
+                    if element.BackgroundColor not in (None, COLOR_SYSTEM_DEFAULT) and \
+                        element.TextColor not in (None, COLOR_SYSTEM_DEFAULT):
+                        element.Widget.tk.eval(
+                    '[ttk::combobox::PopdownWindow {}].f.l configure -foreground {} -background {} -selectforeground {} -selectbackground {}'.format(element.Widget,
+                                                                                                                                                    element.TextColor,
+                                                                                                                                                    element.BackgroundColor,
+                                                                                                                                                    element.BackgroundColor,
+                                                                                                                                                    element.TextColor))
+                except Exception as e:
+                    pass    # going to let this one slide
+
                 # Chr0nic
                 element.TKCombo.bind("<Enter>", lambda event, em=element: testMouseHook2(em))
                 element.TKCombo.bind("<Leave>", lambda event, em=element: testMouseUnhook2(em))