import random
from tkinter import *
root = Tk()
root.geometry("700x500")
root.title("rolling dice")
def roll():
l1=Label(root,font=("times",200))
faces=["\u2680","\u2681","\u2682","\u2683","\u2684","\u2685"]
l1.configure(text=f"{random.choice(faces)}{random.choice(faces)}")
l1.pack()
b1 = Button(root,text="Lets roll", command=roll)
b1.place(x=340,y=0)
root.mainloop()
If I mention the label l1 before def then it is doing what is expected, but I am not able to understand what is happening when I mention it inside def.