A PanedWindow is a container widget that may contain any number of panes, arranged horizontally or vertically.
Each pane contains one widget and each pair of panes is separated by a moveable (via mouse movements) sash. Moving a sash causes the widgets on either side of the sash to be resized.
SyntaxHere is the simple syntax to create this widget −
w = PanedWindow( master, option, ... )Parameters
master − This represents the parent window.
options − Here is the list of most commonly used options for this widget. These options can be used as key-value pairs separated by commas.
bg
The color of the slider and arrowheads when the mouse is not over them.
2bd
The width of the 3-d borders around the entire perimeter of the trough, and also the width of the 3-d effects on the arrowheads and slider. Default is no border around the trough, and a 2-pixel border around the arrowheads and slider.
3borderwidth
Default is 2.
4cursor
The cursor that appears when the mouse is over the window.
5handlepad
Default is 8.
6handlesize
Default is 8.
7height
No default value.
8orient
Default is HORIZONTAL.
9relief
Default is FLAT.
10sashcursor
No default value.
11sashrelief
Default is RAISED.
12sashwidth
Default is 2.
13showhandle
No default value.
14width
No default value.
MethodsPanedWindow objects have these methods −
Sr.No. Methods & Description 1add(child, options)
Adds a child window to the paned window.
2get(startindex [,endindex])
This method returns a specific character or a range of text.
3config(options)
Modifies one or more widget options. If no options are given, the method returns a dictionary containing all current option values.
ExampleTry the following example yourself. Here is how to create a 3-pane widget −
from tkinter import * m1 = PanedWindow() m1.pack(fill=BOTH, expand=1) left = Entry(m1, bd=5) m1.add(left) m2 = PanedWindow(m1, orient=VERTICAL) m1.add(m2) top = Scale( m2, orient=HORIZONTAL) m2.add(top) bottom = Button(m2, text="OK") m2.add(bottom) mainloop()
When the above code is executed, it produces the following result −
python_gui_programming.htm
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4