- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to set the sticky button property properly?
Tkinter Buttons can be configured through the different available attributes and properties in Tkinter. We can add a sticky property to make it sticky relative to the window in which it is residing. The sticky property allows the widget to set the relative position in the window. To make a button sticky, we have to choose the direction or position such as N, E, S, W, NE, NW, SE, SW, and zero.
#Import the tkinter library from tkinter import * from tkinter import ttk #Create an instance of tkiner frame win= Tk() #Define the geometry of the function win.geometry("750x250") #Create a button to close the window btn1 = ttk.Button(win, text ="I am in Column 3") btn1.grid(column=3) btn2=ttk.Button(win, text="I am stuck to South West") btn2.grid(sticky=SW) btn3= ttk.Button(win, text="I am stuck to North west") btn3.grid(sticky=N) win.mainloop()
The above code will display a window that contains some sticky buttons.
- How to properly use h1 in HTML5?
- How to properly enable ffmpeg for matplotlib.animation?
- CSS position: sticky;
- How to programmatically set drawableLeft on Android button?
- How to set the location of a button anywhere in JFrame?
- How to programmatically set drawableLeft on the Android button using Kotlin?
- How to create a sticky image with CSS?
- How to create a sticky element with CSS?
- How to set default button for JFrame in Java?
- HTML DOM Button autofocus Property
- HTML DOM Button disabled Property
- HTML DOM Button name Property
- HTML DOM Button type Property
- HTML DOM Button value Property
- How to customise iOS button to set text and color?