有没有办法在 Windows 上更改当前的 PyGTK 主题? [英] Is there a way to change the current PyGTK theme on Windows?

查看:62
本文介绍了有没有办法在 Windows 上更改当前的 PyGTK 主题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个使用 PyGTK 的 Python 应用程序.它在 Linux 上运行良好,看起来很棒.它在 Windows 上也运行良好,但看起来非常糟糕.默认的 GTK 主题看起来完全不像原生的 Windows GUI 元素.

I've written a Python app that uses PyGTK. It runs fine on Linux and looks great. It also runs fine on Windows, but it looks absolutely awful. The default GTK theme looks absolutely nothing like the native Windows GUI elements.

有什么办法可以让我的 Python 应用程序看起来更好一点吗?也许我可以调用某些函数来将主题更改为更好的主题?

Is there anything I can do to make my Python app look a little better? Perhaps some function I can call to change to theme to something a little nicer?

使用下面答案中建议的 rc_parse() 函数,我现在有:

using the rc_parse() function suggested in the answer below, I now have:

import pygtk,gtk

gtk.rc_parse("C:\\Program Files\\Common Files\\GTK\\2.0\\share\\themes\\Bluecurve\\gtk-2.0\\gtkrc")

window = gtk.Window(gtk.WINDOW_TOPLEVEL)
button = gtk.Button()
button.set_label("Hello")

window.add(button)

button.show()
window.show()

gtk.main()

...但它不起作用.

推荐答案

我相信您正在寻找 rc_parse 函数,它可以让你加载一个带有主题的 gtkrc 文件.另请参阅 http://faq.pygtk.org/index.py?file=faq21.012.htp&req=show,其中展示了如何在 Windows 上更改 GTK 主题.现在问题变成了找到适合您需求的 GTK 主题.一些谷歌搜索结果 http://gtk-wimp.sourceforge.net/,这可能是你需要.

I believe you're looking for the rc_parse function, which will let you load a gtkrc file with a theme. Also, see http://faq.pygtk.org/index.py?file=faq21.012.htp&req=show, which shows how to change the GTK theme on windows. Now the problem becomes finding a GTK theme that fits your needs. Some googling turns up http://gtk-wimp.sourceforge.net/, which may be what you need.

这篇关于有没有办法在 Windows 上更改当前的 PyGTK 主题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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