M
M
M1zukage2020-05-28 17:52:24
Python
M1zukage, 2020-05-28 17:52:24

How to display data from a text document in Tkinter?

Please tell me how to display data from a text editor in Tkinter.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2020-05-28
@dimonchik2013

via variable
or via file

B
BOOMIK305, 2020-05-28
@BOOMIK305

Example:

from tkinter import *

root = Tk()
text = open('file.txt', encoding='utf-8').readlines()
text = ''.join(text)
textline = Text(root)
textline.insert(1.0, text)
textline.pack()
root.mainloop()

Required:
textline.insert(1.0, 'ТЕКСТ')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question