How do you do this in python with tk?

Ali alikakakhel3 at hotmail.com
Tue Oct 12 00:38:24 CEST 2004


> 
> Setting state='disabled' does not only prevent the user from editing the text, 
> but also prevents *you* from modifying the text via the insert or delete 
> methods. So whenever you want to insert or delete lines in the text, you must 
> configure its state to 'normal' before, do the modification, then set back its 
> state to 'disabled'
> 
> HTH

OK so I tryed:

import Tkinter
def add_rows(w, titles, rows):
    t.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()

it still wont show the text I want it to.



More information about the Python-list mailing list