How do you do this in python with tk?

Miki Tebeka miki.tebeka at zoran.com
Tue Oct 12 09:04:32 CEST 2004


Hello Ali,

> import Tkinter
> def add_rows(w, titles, rows):
>     t.state = 'normal'
      w.state = 'normal'
>     for r in rows:
>         for t, v in zip(titles, r):
>             w.insert("end", "%s:\t%s\n" % (t, v))
>         w.insert("end", "\n")
> 
> app = Tkinter.Tk()
> t = Tkinter.Text(app)
> t.pack()
> info = [['Ali',18],
>         ['Zainab',16],
>         ['Khalid',18]]
> add_rows(t, ["Name", "Age"], info)
> app.mainloop()

HTH.
--
------------------------------------------------------------------------
Miki Tebeka <miki.tebeka at zoran.com>
http://tebeka.spymac.net
The only difference between children and adults is the price of the toys



More information about the Python-list mailing list