Python-wxPython中的自定义样式 [英] Python - Custom styling in wxPython

查看:384
本文介绍了Python-wxPython中的自定义样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以在wxPython中创建自定义样式?我搜索了所有有关wxPython样式的文档和网站,但什么也没找到.我必须使用wxPython画布创建自定义样式吗?

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?

推荐答案

wxPython尽可能在其核心窗口小部件中使用本机窗口小部件.大多数小部件将对您使用的系统是本机",因此不幸的是,您无法完全操纵控件如何绘制自身.

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.

有时,您可以通过文档中提到的方法修改小部件,例如使用SetBackgroundColour()SetForegroundColour().根据您操作系统的窗口小部件,它们可能会或可能无法正常工作.

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.

另一种选择是使用wx.PaintDC, wx.ClientDC, wx.WindowDC, wx.ScreenDC and/or wx.MemoryDC直接绘制自定义窗口小部件.

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

这篇关于Python-wxPython中的自定义样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆