Search code examples
pythonuser-interfacetkintertkinter-canvastkinter-entry

How to print same pack multiple times on GUI in tkinter


import tkinter as tk

window = tk.Tk()

window.geometry("200x200")

options = tk.Label(text = "Text")

for i in range (3):
      options.pack()

tk.mainloop()

I want this to print "Text" in the gui, 3 times, on 3 different lines. Any help pls?


Solution

  • import tkinter as tk
    
    window = tk.Tk()
    
    window.geometry("200x200")
    
    
    for i in range (3):
          options = tk.Label(window, text="test label")
          options.pack()
    
    tk.mainloop()
    

    This will work.