Home > Software engineering >  I want to create function that creates a new label tkinter python
I want to create function that creates a new label tkinter python

Time:12-28

I am new to tkinter. Please read the above question and please help.

CodePudding user response:

from tkinter import Label, Tk

root = Tk()

def create_text_lable(display_text:str,x:int,y:int):
    text = Label(root, text=display_text)
    text.grid(row=y,column=x)

create_text_lable("Hello World!",0,0)
create_text_lable("Hello World!",1,1)
create_text_lable("Hello World!",2,2)

root.mainloop()
  • Related