# KLL test frames, made and deleted by functions from Tkinter import * import random root = Tk() root.geometry("600x200") myframe=Frame() #if you do all in functions "def" you need this global! newtext="000" buttontext="delete frame and make new with new content" def make_root(): global newtext,buttontext Label(root,text=newtext).place(x=10,y=10) Button(root,text=buttontext,command = do_delete_new_frame).place(x=20,y=100) def frame_content(): global myframe,newtext Label(myframe,text=newtext).place(x=20,y=20) # positioning in frame coords def do_delete_new_frame(): global myframe,newtext myframe.destroy() newtext=str(random.randint(0,999)) make_frame() def make_frame(): global myframe,newtext insertx=400 inserty=0 framewidth=200 frameheight=180 myframe = Frame(root, width=framewidth, height=frameheight, bg="blue") myframe.place(x=insertx,y=inserty) # positioning in root coords frame_content() make_root() make_frame() root.mainloop()