Tkinter Widget-Frame

Frame is a very important . It is just like a container and frame is used to manage the layout of “tkinter” Application, which is a rectangular container


w = Frame ( main, option)
Main- parent Window.
Option- attribute of button widget.
  1. from tkinter import *  
  2. main = Tk()  
  3. frame = Frame(main)  
  4. frame.pack()  
  5. bttframe = Frame(main)  
  6. bttframe.pack( side = BOTTOM )  
  7. button = Button(frame, text="c# corner", fg="blue")  
  8. button.pack( side = LEFT)  
  9. button1 = Button(frame, text="python", fg="red")  
  10. button1.pack( side = LEFT )  

Option Description
bgNormal background color.
bdIt sets border width in pixels. Default is 2.
cursorCursor is used to create a cursor in canvas like arrow, circle, dot etc.
height It is used to set the height of widgets.
It changes background color of widgets on focus.
It changes the color of widgets on focus.
highlightthicknessIt is used to set thickness of the focus highlight.
reliefRelief is special type of border. The values are SUNKEN, RAISED, GROOVE, and RIDGE.
It is used to set the width of widgets.

In this chapter, you learnt what frame widget is and how to use the property of the widget.
Next » Tkinter widget -Label