Python GUI Development with GTK+ 3 - Tutorial 13 - Sorting and Handling Selections

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

Instead of connecting "changed" on selection as in the tutorial, connect "row-activated" on the treeview:
people_tree_view.connect("row-activated", self.row_selected)

And here's the function:
def row_selected(self, treeview, treepath, treecolumn):
model = treeview.get_model()
row = treepath
print "Name = ", model[row][0]
print "Age = ", model[row][1]
print "Job = ", model[row][2]

TonyFreeman
Автор

Woooow!
You are definitely a melomaniac!
Good voice!
0:36 👈

pacopaquito
Автор

Hi! Love this series of tutorials. I wonder if you would create one with MariaDB as a datastore? TreeView gets its data from SQL and has a Master-/Detail-View. And how to change the layout when i.e. switching from customer addresses to products from a store. Products maybe with a picture and drag/drop to add it.

karlranseyer
Автор

I don't know why, but column.set_sort_column_id(i) doesn't allow me to sort the columns. It just doesn't do anything when I click the column titles.

kneekoo
Автор

Weird that this ‘datagrid’ is a treeview 🤔

RhoTrepaan