0

I am writing a Python application and I want to get the colour of the panel (window) that contains the gui. This is theme dependent. Is it possible to retrieve theme colours programmatically? I've tried:

import wx

class MainFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, 'Panel colour')
        panel = MainPanel(self)
        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(panel)
        self.SetSizerAndFit(main_sizer)

        self.Centre()
        self.Show()
        print(self.GetBackgroundColour())
        print(panel.GetBackgroundColour())

class MainPanel(wx.Panel):
    def __init__(self, frame):
        wx.Panel.__init__(self, frame)
        lbl_description = wx.StaticText(self, label='Hello world')
        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(lbl_description, flag=wx.ALL, border=10)
        self.SetSizer(main_sizer)


if __name__ == "__main__":
    screen_app = wx.App()
    main_frame = MainFrame()
    screen_app.MainLoop()
Psionman
  • 175
  • 1
  • 12

0 Answers0