Re: ListStore y python



On 30/11/05, Fernando San Martín Woerner <snmartin galilea cl> wrote:
> On mié, 2005-11-30 at 11:39 -0300, Mario Gonzalez wrote:
> >   Holas, Tengo una consulta, he estado leyendo la documentacion pero
> > queria ver si alguien de por aca tendria algun codigo (si no fuera
> > mucho pedir) de ejemplo acerca de como manejar los liststore y
> > treeviews de forma optima en Python.
> >
>
> ej:
> -----------------------------------------------------------------------------------
> import gtk
>
> w = gtk.Window()
> w.set_title('test')
> w.connect('delete-event', gtk.main_quit)
>
> l = gtk.ListStore(str, int)
> l.append(['uno', 1])
> l.append(['dos', 2])
> l.append(['tres', 3])
> l.append(['cuatro', 4])
>
> t = gtk.TreeView()
> t.set_model(l)
>
> t.append_column(gtk.TreeViewColumn('Descripcion',
> gtk.CellRendererText(), text=0))
> t.append_column(gtk.TreeViewColumn('Valor', gtk.CellRendererText(),
> text=1))
> s = gtk.ScrolledWindow()
> w.add(s)
> s.add(t)
>
> w.show_all()
>
> gtk.main()
> -----------------------------------------------------------------------------------
> eso es lo básico, puedes leer el tutorial de pygtk, ahí salen mejores
> ejemplos, lo más complicado de treeview es conocer de columnas y
> modelos.
>
> http://www.pygtk.org/tutorial.html
>
   Te pasaste Fernando!! muchisimas gracias por tu tiempo!!

>
> saludos
>
  Saludos igualmente.

>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]