The Tkinter PanedWindow widget is used to divide a window or a frame space. Generally, the PanedWindow is a frame that acts as a container for grouping, organizing, and holding smaller widgets.
A PanedWindow generally holds both the horizontal and vertical stacks of the child widgets. A sash, typically a bar with a scrolling square, divides the frame or the window in the frame window. A user can resize the child widgets to the desired sizes using the sash.
How Does PanedWindow Work?
To create a panedWindow widget, you should follow the following simple syntax:
ttk.PanedWindow(container, **options) |
Options for Paned Windows
The following are the most common options used when creating the panedWindows:
Bg- defines the widget's background color.
Bd- defines the width of the widger's border.
Borderwidth- determines the width of the widget's border.
Pointer- specifies how the cursor behaves when hovering over a widget.
Handlepad- sets the distance between the handle and the end of the sash.
Handlesize- defines the handle's size.
Height- determines the widget's height.
Relief-The sort of border is specified by this option. The flat value is the default.
Sashpad - defines the padding that should be done around each sash.
Sashrelief- establishes the sort of border surrounding each sash.
Sashwidth- specifies the sash's width.
Showhandle- If set to true, Showhandle shows handles.
Width- specifies the widget's width.An Example of PanedWindow Options
An Example of PanedWindow
from tkinter import * from tkinter import ttk root = Tk() pw = PanedWindow(orient ='vertical') top = ttk.Button(pw, text ="Click here !\n Mr Programmer") top.pack(side = TOP) pw.add(top) bot = Checkbutton(pw, text ="Check here") bot.pack(side = TOP) pw.add(bot) label = Label(pw, text ="Programming scene") label.pack(side = TOP) pw.add(label) string = StringVar() entry = Entry(pw, textvariable = string, font =('arial', 45, 'bold')) entry.pack() entry.focus_force() pw.add(entry) pw.pack(fill = BOTH, expand = True) pw.configure(sashrelief = RAISED) mainloop()
|
Article Contributed By :
|
|
|
|
514 Views |