I have a problem with a typeError in tkinter. I wrote this tiny test program to illustrate my problem:
from tkinter import *
window = Tk()
Text(window, width=67, height=10).grid()
Text.insert(END, "test")
window.mainloop()
When I run the program, I get this error:
TypeError: insert() missing 1 required positional argument: 'chars'
However, I have no idea what this argument is. It is not said or used in any tutorial I see ( effbot for example)
I'm sure there is something really simple I'm overlooking, but I can't find it for the life of me.
Thanks in advance for any help!
You haven't set your text widget to a variable, even if you had grid
returns None so it still wouldn't work:
from tkinter import *
window = Tk()
my_text = Text(window)
my_text.grid()
my_text.insert(END, "test")
window.mainloop()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.