[pygtk] Is it possible to create a table with drag-and-dropable compound cells in PyGTK?
geraldhofmair at hotmail.com
Thu Jun 7 17:00:40 WST 2012
Hi! I've been trying for quite some time to create a table with drag-and-dropable cells in PyGTK, but I can't find a way to do it. My goal:A GUI of a table in which I can drag the contents of a cell over another cell and drop it there.* IMPORTANT: each cell consists of three parts - a string, an icon and a combobox* cells should look more like squares than like lines; Therefore, these three parts of each cell should be arranged vertically to each other, as if they were in a VBox* no grid lines required* I don't really care about the data model as long as the GUI works The problem:I tried two different approaches to implement my goal, one using a gtk.TreeView and one using a gtk.Table, and both times I could not figure out how to achieve the desired behaviour. With the TreeView, the problem is the vertical layout of the cell parts. I found the following code, which suggests that vertical layouts in TreeView cells are possible in GTK in general. Is there any way to implement this in PyGTK? "HowTo: Pack Gtk CellRenderers vertically in a Gtk TreeView[...]
var treeview = Gtk.TreeView();
var column = new Gtk.TreeViewColumn();var cellrenderer_1 = Gtk.CellRendererPixbuf();
var cellrenderer_2 = Gtk.CellRendererText();column.add_attribute(cellrenderer_1, "pixbuf", 0);
column.add_attribute(cellrenderer_2, "markup", 1);(column.get_area() as Gtk.Orientable).set_orientation(Gtk.Orientation.VERTICAL);column.pack_start(cellrenderer_1, false);
[...] "source: http://whyareyoureadingthisurl.wordpress.com/2012/01/21/howto-pack-gtk-cellrenderers-vertically-in-a-gtk-treeview/ Using a gtk.Table I could not figure out how to determine the column in which a cell was dropped after a drag-and-drop operation. In addition, this implementation is more complicated, less robust and harder to manage than the TreeView implementation. Therefore I would prefer a solution based on a TreeView, if possible. Any suggestions? Thanks,Gerald
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pygtk