gtk treeview:将图像按钮放在行上
对于树视图中的每一行,我想要 4 个彼此相邻的图像按钮。它们就像单选按钮一样,一次只能激活一个。每个按钮都有一个“开”和“关”图像。
我该怎么做?我弄清楚了如何将图像放在那里,以及如何放置切换按钮,但这似乎需要更多的努力,因为没有预构建的单元渲染器可以完成我想要的操作。
基本上解决我的问题的是弄清楚如何使 gtk.treeview 中的图像可点击。有什么想法吗?
For each row in my treeview, I want 4 image buttons next to each other. They will act like radio buttons, with only one being activateable at a time. Each button has an 'on' and 'off' image.
How do I do this? I figured out how to put images there, and how to put togglebuttons, but this seems to require some more effort as there is no pre-built cellrenderer that does what I want.
Basically what'd solve my problem is figuring out how to make an image in a gtk.treeview
clickable. any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是一个没有
kiwi
要求的简短版本。Here is a short version without
kiwi
requirement.看看这个'http://www.daa.com.au/pipermail/pygtk/2010-March/ 018355.html'。它向您展示了如何使 gtk.CellRendererPixbuf 可激活,并能够连接到单击事件信号。
更新
正如这个答案所指出的,或者给出的参考并不像广告中那样工作。它缺少 do_activate 方法,该方法需要发出单击信号。一旦完成,cell.connect 就可以工作了。
抱歉,如果这个答案误导了任何人。
Have a look at this 'http://www.daa.com.au/pipermail/pygtk/2010-March/018355.html'. It shows you how to make a gtk.CellRendererPixbuf activatable, and able to connect to a click event signal.
Update
As pointed out this answer, or the reference given doesn't work as advertised. It's missing the do_activate method, which needs to emit the clicked signal. Once it's done that, then the cell.connect will work.
Sorry if this answer mislead anyone.
这对我有用:
Here is what worked for me: