Nehal Birla
Nehal Birla

Reputation: 172

bordermode attribute in place() method of tkinter python

What is the difference between bordermode = OUTSIDE and bordermode = INSIDE attribute in place() method of tkinter in python?

Upvotes: 2

Views: 2466

Answers (1)

rassar
rassar

Reputation: 5680

From the tkinter/__init__.py file:

bordermode="inside" or "outside" - whether to take border width of
                                   master widget into account

For example:

from tkinter import *

root = Tk()
f1 = Frame(root, borderwidth=5, relief=SUNKEN, width=50, height=50)
f1.pack()
l1 = Label(f1, text="Hi")
l1.place(x=10, y=10, bordermode="outside")

f2 = Frame(root, borderwidth=5, relief=SUNKEN, width=50, height=50)
f2.pack()
l2 = Label(f2, text="Hi")
l2.place(x=10, y=10, bordermode="inside")

root.mainloop()

bordermode testing

So, outside counts x and y from the top left corner of the frame including the border, while inside counts it without the border.

Upvotes: 4

Related Questions