#frame_example.py from tkinter import * rootWin = Tk() #Main frame, with a thin solid border frame = Frame(rootWin, borderwidth=1, relief="solid") frame.pack() #Put the label in the main frame label = Label(frame,text="This is the Label!") label.pack() #Try side=LEFT as a parameter! #Inner frame, with a very thick "raised" border. frame2 = Frame(frame, borderwidth=15,relief="raised") frame2.pack() #Does not actually quit the program, instead it just #prints a message! def quitFunc(): print("Quit button pressed!") #The speakFunc just prints a message! def speakFunc(): print("Say hi!") #These two buttons are inside the "inner" frame. #foreground (fg) color of red, displays the text "Quit", # and will call the quitFunc when it is clicked. button1 = Button(frame2, text="Quit", fg="red", command=quitFunc) button1.pack(side=RIGHT) #Try TOP/BOTTOM/LEFT... #Create another button, displaying the text "Speak" and programmed #to call the speakFunc when it is clicked. button2 = Button(frame2, text="Speak", command=speakFunc) button2.pack(side=LEFT) rootWin.mainloop() #Run the main loop.