I'm working a tkinter application, i want to display a read only text file, whenever i add the text file using label or text, the file is not oranised at all
I want to open a text file in Label or Text(which ever works), but what I keep getting is a text that skids beyond my window frame. I added the scroll button, it's still doing the same thing. I want to the text to be well ordered in a specified Label/Text widgets(read only). thank you in advance.
from tkinter import *
root = Tk()
text_file = open("C:\\Users\stone's\Desktop\\works.txt")
text1 = text_file.read()
for i in text1:
if len(text1)==50:
## MOVE TO NEXT LINE
Label(root, text="%s" % ('\n'),
font=('Bradley Hand ITC', '25', 'bold'),
bg='#c9e3c1').pack()
else:
## DON'T MOVE OVER TO NEXT LINE
Label(root, text="%s" % (i), font=('Bradley Hand ITC',
'25', 'bold'
),
bg='#c9e3c1').pack(side = LEFT)
## ALL I'M TRYING TO DO IS TO SHOW A TEXT ON A LABEL APPROPRIATELY
## WITHOUT THE TEXTS SKIDDING OUT OF THE WINDOW FRAME
root.mainloop()