问题描述
我正在研究用python编写的GTK +应用程序。我明显使用PyGtk。我的应用程序是关于视频的集合。这是一种F-spot或Picasa,但用于视频。
正如您在这两个应用程序中看到的,您有一个中心区域,您可以在其中看到所有的带有标签缩略图的照片。
在我的应用程序中,我想实现相同的视角。现在我简单地使用它:
包含 VBox 的
A gtk.Table
code>,在 VBox
a Pixbuf
(我的视频缩略图)和 HBox
,并且在 HBox
内,多于 Pixbuf
作为标签。
它正在工作,但它很丑,看起来这不是更好的解决方案。
深入研究文档,我发现两个小部件靠近我的neeeds: IconView
和 TreeView
。但是 IconView
每个行只能显示一个pixbuf,而TreeView不显示为像 IconView
的网格。
我的问题:有没有像TreeView一样显示TreeView的方法(在网格中)?
您如何实施F-spot安排照片和标签的方式?
解决方案最好的方法是坚持一个表和重新实现的选择或使用自定义版本的IconView与自定义cellrenderer这可以采取gtk.HBox()。
有关自定义cellrenderer的一些指南是:
讨论发生在pygtk邮件列表上:
htp://old.nabble.com/Drawing-widgets-in-a-custom-cellrenderer-td14207692.html
WWWalter制作示例代码:
根据Ruben Vermeersch的说法,f-pot使用IconView的修改版本。代码可以在这里找到:
I am working on a GTK+ application written in python. I obviously use PyGtk. My application is about collections of videos. It's a kind of F-spot or Picasa, but for video.
As you can see in these two apps, you have a central area where you can see all of your photos with tag thumbnails under.
In my app, I want to implement the same kinf of view. For now I simply use this:
A gtk.Table
containing a VBox
, inside the VBox
a Pixbuf
(my video thumbnail) and a HBox
, and inside the HBox
, as many Pixbuf
as tags.
It's working but it's ugly and It seems like It's not the better solution.
Looking deeply in the docs, I have found two widgets near my neeeds: IconView
and TreeView
. But IconView
can only display one pixbuf per "row" and TreeView don't display as a grid like IconView
.
My question: Is there a way to display a TreeView like an IconView (in a grid) ?How would you implement the F-spot way of arranging photos and tags under?
解决方案 The best approach is either to stick with a table and reimplement selections or Use a custom version of IconView with a custom cellrenderer wich can take gtk.HBox().
Some guidelines about custom cellrenderer are :
http://faq.pygtk.org/index.py?req=show&file=faq13.045.htp
http://faq.pygtk.org/index.py?req=show&file=faq13.056.htp
a discuss occured on pygtk mailing list :
htp://old.nabble.com/Drawing-widgets-in-a-custom-cellrenderer-td14207692.html
WWWalter make a sample code :http://www.translate.org.za/blogs/walter/en/content/conquering-cellrendererwidget
According to Ruben Vermeersch, f-pot use a modified version of IconView. Code can be found here :http://git.gnome.org/browse/f-spot/?h=icon-view-cleanup
这篇关于这可能画GtkTreeView像GtkIconView列出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!