How to create a custom GUI for a python program?

后端 未结 5 803

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

5条回答
  •  萌比男神i
    2021-02-09 01:07

    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.

提交回复
热议问题