Now that we are done discussing styling options, let's wrap up with a discussion on some commonly used options for the root window:
Method |
Description |
*root.geometry('142x280+150+200') |
You can specify the size and location of a root window by using a string of the widthxheight + xoffset + yoffset form. |
self.root.wm_iconbitmap('mynewicon.ico') OR self.root.iconbitmap('mynewicon.ico ') |
This changes the title bar icon to something that is different from the default Tk icon. |
root.overrideredirect(1) |
This removes the root border frame. It |
Let's explain these styling options in more detail:
- root.geometry('142x280+150+200'): Specifying the geometry of the root window limits the launch size of the root window. If the widgets do not fit in the specified size, they get clipped from the window. It is often better not to specify this and let Tkinter decide this for you.
- self.root.wm_iconbitmap('my_icon.ico') or self.root.iconbitmap('my_icon.ico '): This option is only applicable to Windows. Unix-based operating systems do not display the title bar icon.