How to print txt ['text'] in canavs/tkinter | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to print txt ['text'] in canavs/tkinter

I want to print the text of txt=canvas.create_text (...,text='this is some text') I want the program to print 'this is some text ' I used print (txt['text']) it shows an error: int object is not subscriptable

22nd Jan 2020, 12:20 PM
Pattern
Pattern - avatar
2 Answers
0
This is irrelevant
22nd Jan 2020, 12:29 PM
Pattern
Pattern - avatar
- 1
Try this import tkinter main = tkinter.Tk() label = tkinter.Label(main, text="some text") main.mainloop() label.pack()
22nd Jan 2020, 12:25 PM
DeeR
DeeR - avatar