How do you do this in python with tk?
eric_brunel at despammed.com
Wed Oct 13 10:01:39 CEST 2004
> well I tryed this:
> import Tkinter
> def add_rows(w, titles, rows):
> t.configure(state = 'normal')
REMOVE THAT LINE! Since you use t as a local variable afterwards, this will make
the whole script fail. BTW, this means this isn't the code you actually used,
since it doesn't display any window at all.
> w.configure(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)
> info = [['Ali',18],
> add_rows(t, ["Name", "Age"], info)
> Well... it shows the window, it doesnt show text, it still lets me type in stuff :(
> What is wrong now?
You never set the text state to disabled, so no wonder you can still type text in...
- Eric Brunel <eric (underscore) brunel (at) despammed (dot) com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
More information about the Python-list