Python - Custom styling in wxPython

前提是你 提交于 2020-05-30 08:10:09

问题


Is there some way I can create custom styles in wxPython? I searched all the docs and websites referring to wxPython styling and could find nothing. Do I have to create the custom style using the wxPython canvas?


回答1:


wxPython uses native widgets in its core widgets as much as possible. Most of the widgets are going to be "native" to the system you are using, so unfortunately you can't fully manipulate how the control paints itself.

Sometimes, you can modify widgets via the methods mentioned in the documentation, such as using SetBackgroundColour() or SetForegroundColour(). Depending on your OS's widget, they may or may not work.

The other option is to use the wx.PaintDC, wx.ClientDC, wx.WindowDC, wx.ScreenDC and/or wx.MemoryDC to draw custom widgets directly.



来源:https://stackoverflow.com/questions/56159215/python-custom-styling-in-wxpython

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!