Anchor Properties in tkinter Button
The Tkinter module defines a number of anchor constants that you can use to control where items are positioned relative to their context. For example, anchors can specify where a widget is located inside a frame when the frame is bigger than the widget.
******Your code Below*****
from tkinter import *
root= Tk()
root.title("Anchor Example")
root.config(background="#FFF8DC")
root.geometry("900x560+350+50")
btn1= Button(root, text="NW",font=("Times", 15,"bold"),width=30,height=3,anchor=NW)
btn2= Button(root, text="N",font=("Times", 15,"bold"),width=30,height=3,anchor=N)
btn3= Button(root, text="NE",font=("Times", 15,"bold"),width=30,height=3,anchor=NE)
btn4= Button(root, text="CENTER",font=("Times", 15,"bold"),width=30,height=3,anchor=CENTER)
btn5= Button(root, text="SW",font=("Times", 15,"bold"),width=30,height=3,anchor=SW)
btn6= Button(root, text="SE",font=("Times", 15,"bold"),width=30,height=3,anchor=SE)
btn1.pack(pady=2)
btn2.pack(pady=2)
btn3.pack(pady=2)
btn4.pack(pady=2)
btn5.pack(pady=2)
btn6.pack(pady=2)
root.mainloop()
********End Code**********
Write Down Code Your Code Editor. To show Your Output. If Use Pycharm Press Shift+F10 and Show Your Output.
Enjoy..............
If You Want To Learn More Plz Visit www.newpost24.com
If You Find Specific link plz Follow This Page.
Post a Comment