How do you do this in python with tk?

Ali alikakakhel3 at
Fri Oct 8 18:49:49 CEST 2004

Jeff Epler <jepler at> wrote in message news:<mailman.4538.1097192656.5135.python-list at>...
> You could create a Text widget and insert lines of text in it.
> import Tkinter
> def add_rows(w, titles, rows):
>     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()
> If there are many lines, you can use a scrollbar widget to scroll the
> text widget.  You can use the tabs= argument of the Text widget to
> adjust the alignment of the second column.  If you want to make the
> items "interactive", you can use tags and tag_bind to react to things
> like button presses.  You can set the text widget to be "disabled" to
> keep the user from changing the contents.
> Jeff
> --

I will try out your code. Thank you for helping.

More information about the Python-list mailing list