Open MesterPerfect opened 1 year ago
This is the result I get when I try to apply a dark theme to my program
More annoying my app MeerK40t (https://github.com/meerk40t/meerk40t) literally does support darkmode for linux and osx but the windows version is a flashlight in your eyes.
You could do this, but you'd basically need to force change all the colors on every widget you use, or build a dark-mode capable set of them
https://www.blog.pythonlibrary.org/2011/11/05/wxpython-creating-a-dark-mode/
I found the original wxWidgets experimentally supports dark mode with MSWEnableDarkMode() on ver3.3 (not released yet). https://docs.wxwidgets.org/latest/classwx_app.html#af8c93d7e3345e62a58325f3ab1d158d6
Are there any plans to support dark mode on wxpython?
Ping. Any plans on getting dark mode support on wxPython for Windows? The users is asking for it. Just implementing the undocumented MSWEnableDarkMode()
is worth a shot.
Ping. I hope dark mode will be added in the next release.
It will probably be a while before this will be supported in wxPython. I don't have any plans to move to the unstable branch of wxWidgets (3.3). Perhaps you could look into asking if the MSWEnableDarkMode patches could be backported to 3.2.
Operating system: windows 10
wxPython version & source: wxpython=4.11 pypi
Python version & source: python3.9.9
Description of the problem: I can't use dark mode on Windows
Code Example (click to expand)
```python import wx class MyFrame(wx.Frame): def __init__(self, parent, title): super(MyFrame, self).__init__(parent, title=title, size=(400, 300)) self.panel = wx.Panel(self) # Set dark theme colors dark_bg_color = "#252525" # Dark background color dark_fg_color = "#FFFFFF" # Dark foreground color # Set dark theme for the frame and panel self.SetBackgroundColour(dark_bg_color) self.panel.SetBackgroundColour(dark_bg_color) # Creating a read-only multi-line edit box self.text_ctrl = wx.TextCtrl(self.panel, style=wx.TE_MULTILINE | wx.TE_READONLY) # Creating buttons self.button1 = wx.Button(self.panel, label='Button 1') self.button2 = wx.Button(self.panel, label='Button 2') self.button3 = wx.Button(self.panel, label='Button 3') self.button4 = wx.Button(self.panel, label='Button 4') # Creating an edit box for path and browse button self.path_text_ctrl = wx.TextCtrl(self.panel) self.browse_button = wx.Button(self.panel, label='Browse') # Setting up the layout using a sizer sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.text_ctrl, proportion=1, flag=wx.EXPAND | wx.ALL, border=10) button_sizer = wx.BoxSizer(wx.HORIZONTAL) button_sizer.Add(self.button1, proportion=1, flag=wx.EXPAND | wx.ALL, border=5) button_sizer.Add(self.button2, proportion=1, flag=wx.EXPAND | wx.ALL, border=5) button_sizer.Add(self.button3, proportion=1, flag=wx.EXPAND | wx.ALL, border=5) button_sizer.Add(self.button4, proportion=1, flag=wx.EXPAND | wx.ALL, border=5) path_sizer = wx.BoxSizer(wx.HORIZONTAL) path_sizer.Add(self.path_text_ctrl, proportion=1, flag=wx.EXPAND | wx.ALL, border=5) path_sizer.Add(self.browse_button, flag=wx.ALL, border=5) sizer.Add(button_sizer, flag=wx.EXPAND) sizer.Add(path_sizer, flag=wx.EXPAND | wx.ALL, border=10) self.panel.SetSizer(sizer) # Binding events self.browse_button.Bind(wx.EVT_BUTTON, self.on_browse) def on_browse(self, event): dialog = wx.FileDialog(self, "Choose a file", style=wx.FD_OPEN) if dialog.ShowModal() == wx.ID_OK: path = dialog.GetPath() self.path_text_ctrl.SetValue(path) dialog.Destroy() if __name__ == '__main__': app = wx.App() frame = MyFrame(None, "Window with wxPython") frame.Show() app.MainLoop() ```