I want to use the main()
to create the text and display it in a tkinter widget but I don't know how to make it.
import sys, time, os, random
from tkinter.messagebox import *
from tkinter import *
filepath = "file.txt"
root = Tk()
root.configure(bg=color_black)
def main():
file = open('file.txt', "r")
for line in file:
message = line
for char in message:
sys.stdout.write(char)
sys.stdout.flush()
my_label.config(text=char)
time.sleep(random.uniform(0,0.05))
file.close()
global my_label
my_label = Label(root, text="")
my_label.pack(pady=10)
main()
root.mainloop()