股票图标没有显示在按钮上 [英] Stock Icons not shown on buttons

查看:167
本文介绍了股票图标没有显示在按钮上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  self.button = gtk.Button(stock = gtk.STOCK_DELETE)

仅显示:
删除

解决方案

这是GTK的最新变化 - 开发人员想要图标不要出现在按钮上。在Linux上,可以通过编辑 gconf 键来改变它。

  /桌面/ gnome /界面/ buttons_have_icons 

在windows上,我想(我没有真正尝试过)你需要在你的gtkrc文件中设置一个值(对于我来说,它位于 C:\ Program Files \Gtk + \\\\\\\\\\\\\\\\\\\\\'支持图标(我认为默认的不是)。



您也可以添加 gtk-button-images = 1 之后设置可能超过 gconf 选项的主题〜/ .gtkrc-2.0 / code>。



编辑回答您的评论:

就像这个答案,但在Python中:在Gtk中,如何制作一个带有股票图标的按钮?



对于python,它只是

  image = gtk.Image()
#(来自http://www.pygtk.org/docs/pygtk/gtk-stock-items.html)
image.set_from_stock(gtk。 STOCK _ **)
button = gtk.Button()
button.set_image(image)
button.set_label()


self.button = gtk.Button(stock=gtk.STOCK_DELETE)

Only Shows: Delete

解决方案

This is a recent change in GTK - the developers wanted icons not to appear on buttons. On Linux, this can be changed by editing the gconf key

/desktop/gnome/interface/buttons_have_icons

On windows, I think (I haven't actually tried this) that you need to set a value in your gtkrc file (for me it's in C:\Program Files\Gtk+\etc\gtkrc) and use a theme that supports icons (I think the default one doesn't).

You can also add gtk-button-images = 1 to your ~/.gtkrc-2.0 file after setting the theme which may over ride the option from gconf.

EDIT in answer to your comment:

Just like this answer, but in Python: In Gtk, how do I make a Button with just a stock icon?

For python, it's just

image = gtk.Image()
#  (from http://www.pygtk.org/docs/pygtk/gtk-stock-items.html)
image.set_from_stock(gtk.STOCK_**)
button = gtk.Button()
button.set_image(image)
button.set_label("")

这篇关于股票图标没有显示在按钮上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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