import wx

class MyFrame(wx.Frame):
    def __init__(self):
        super().__init__(parent=None, title="Retrieve the system theme", size=(600, 400))
        
        panel = wx.Panel(self)
        
        # Get the system's appearance
        appearance = wx.SystemSettings.GetAppearance()

        # Determine if the theme is dark or light
        if appearance.IsDark():
            theme = "Dark"
        else:
            theme = "Light"

        # A font can be retrieved from the OS default font
        # and modified
        font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
        font.SetStyle(wx.NORMAL)
        fontSize = self.GetFont().GetPointSize()
        font.SetPointSize(fontSize+4)
        
        # Display the information in the panel
        msg_1 = f"Current system theme : {theme}"
        label_1 = wx.StaticText(panel, label=msg_1, style=wx.ALIGN_CENTER)
        msg_2 = f"""Works correctly with :\n● wxPython 4.2.4 and wxWidgets 3.2.8\nbut not\n● wxpython-4.3.0a16030 and wxWidgets 3.3.0"""
        label_2 = wx.StaticText(panel, label=msg_2, style=wx.ALIGN_CENTER)
        msg_3 = f"Tested with Windows 11"
        label_3 = wx.StaticText(panel, label=msg_3, style=wx.ALIGN_CENTER)
        
        font.SetWeight(wx.BOLD)
        label_1.SetFont(font)
        font.SetWeight(wx.NORMAL)
        label_2.SetFont(font)
        label_3.SetFont(font)
        
        # Layout
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.AddStretchSpacer()
        sizer.Add(label_1, 0, wx.ALL | wx.CENTER, 10)
        sizer.Add(label_2, 0, wx.ALL | wx.CENTER, 10)
        sizer.Add(label_3, 0, wx.ALL | wx.CENTER, 10)
        sizer.AddStretchSpacer()
        panel.SetSizer(sizer)

        self.Show()

if __name__ == "__main__":
    app = wx.App(False)
    frame = MyFrame()
    app.MainLoop()
