Look at this excellent tutorial :
http://www.learningpython.com/2006/09/02/extending-our-pygtk-application/
David.
Matt Clark wrote:
> I thought before I submit a bug I'd see if anyone can point out where
> I'm going wrong. My problem is that in an app I'm developing I'm not
> getting row-activated signals from a GtkTreeView under pygtk on an
> N800, but they work fine under pygtk elsewhere (e.g. Ubuntu Feisty
> (python 2.5.1), or OS X/Fink (python 2.4.2)). The N800 is latest
> firmware with no changes except the addition of the latest osso-
> xterm, python2.5-runtime and dropbear.
>
> Sample code follows, and is runnable on maemo or on stock GTK.
>
> Thanks
>
> Matt
>
> ---------------------------------------------------------
>
> import pygtk, gtk
>
> try:
> import hildon
> app = hildon.Program()
> window = hildon.Window()
> app.add_window(window)
> except:
> window = gtk.Window(gtk.WINDOW_TOPLEVEL)
>
> def activation_callback(treeview, path, view_column):
> print 'You will not see this output on an N800'
> print 'But you will on Ubuntu and OS X'
> model = treeview.get_model()
> iter = model.get_iter(path)
> val = model.get_value(iter, 0)
> print 'Value of first item in row is %s' % val
>
> store = gtk.TreeStore(str)
> parentiter = store.append(None, ['parent item 0'])
> childiter = store.append(parentiter, ['child item 0'])
>
> view = gtk.TreeView(model = store)
> cellrenderer = gtk.CellRendererText()
> column = gtk.TreeViewColumn('Column', cellrenderer, text=0)
> view.append_column(column)
> view.connect("row-activated", activation_callback)
>
> window.add(view)
>
> view.expand_all()
> view.show_all()
> window.show()
>
> gtk.main()
> _______________________________________________
> maemo-developers mailing list
> [email protected]
> https://maemo.org/mailman/listinfo/maemo-developers
>
>
_______________________________________________
maemo-developers mailing list
[email protected]
https://maemo.org/mailman/listinfo/maemo-developers