I want to create a GUI for a python program with a custom design, I have a mock-up in Photoshop and I'm looking for a library that supports theme or any other library that can do the job.
My GUI design contains gradients, borders, border radius, and a custom title bar with custom minimize and close buttons, for example take a look at the Github client for Windows, or any Adobe software installer.
I tried wxPython, I used style=wx.NO_BORDER
to remove the title bar and the default border added by Windows, but I feel like I'm not using the right tool for this job and I read somewhere that wxPython is mainly for native look GUI's and not meant for this kind of customization so I should look for something else.
I found an answer here recommending the use of PyQT and QML to make high customization in GUI's, but the compiled file have a very large size.
So what should I use to create a custom GUI ? I'm looking to compile the program too so I need to do it with a reasonable file size.
Your initial approach with wxPython is fine, you just need a couple more style flags for your top wx.Frame
:
wx.NO_BORDER ^ wx.SYSTEM_MENU ^ wx.MINIMIZE_BOX ^ wx.MAXIMIZE_BOX ^ wx.CLOSE_BOX
Which will not only remove the border but the system menu and min/max/close boxes as well.
Then paint your gui background directly on the client area of your top frame.
See this tutorial: and notice that wx.DeviceContext
supports painting bitmaps and gradient fills.
Now make your custom buttons and have them post wx.CloseEvent
, wx.IconizeEvent
, and wx.MaximizeEvent
events when clicked. Lay them out on your custom frame using either absolute positioning or a Sizer
. Done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With