Untitled
unknown
plain_text
9 months ago
2.4 kB
6
Indexable
import tkinter as tk
import time
class TypewriterApp:
def __init__(self, root):
self.root = root
self.root.title("A Missed Hii")
self.root.geometry("800x1000")
self.root.configure(bg="black")
self.canvas = tk.Canvas(root, width=800, height=1000, bg="black")
self.canvas.pack()
self.text_display = self.canvas.create_text(400, 50, text="", font=("Courier", 20, "bold"), fill="white", width=800, anchor="center")
self.text_to_type = ("In a messy chat, where voices blend, \n"
"A simple greeting you chose to send. \n"
"hi rubaid, you wrote to me, so soft, so true— \n"
"But lost in words, I never knew. \n\n"
"The chat moved fast, a blur, a haze,\n"
"I was dumbfounded, felt tired in endless waves.\n"
"It was my first time in a group chat\n"
"It was almost like I was wearing an oversized brain-covering hat.\n"
"Uncertain, lost, I couldnt see,\n"
"The warmth you sent so casually.\n\n"
"I was an idiot, Obviously yes, I wont deny,\n"
"Clueless, awkward, passing by.\n"
"Too caught up in my own stupid mind,\n"
"To notice your kindness, warm and kind.\n\n"
"I failed to see, I missed my cue,\n"
"A tiny slip, yet it is now haunting me too.\n\n"
"So here I stand with words sincere,\n"
"A whispered sorry, loud and clear.\n"
"Forgive that moment, lost in space,\n"
"For now, I cherish your every trace.\n\n"
"With heart burdened, I say sorry with all my being\n"
"Forgive me Babui after giving me a spanking\n"
"But here it is, I smile and shout—at last—\n\n"
"HIII XINIAAA!, to you, MY SHINING STAR!")
self.index = 0
self.root.after(1000, self.type_text)
def type_text(self):
if self.index < len(self.text_to_type):
current_text = self.canvas.itemcget(self.text_display, "text")
self.canvas.itemconfig(self.text_display, text=current_text + self.text_to_type[self.index])
self.index += 1
self.root.after(50, self.type_text)
if __name__ == "__main__":
root = tk.Tk()
app = TypewriterApp(root)
root.mainloop()
Editor is loading...
Leave a Comment