Hello dear readers! welcome back to another section of our tutorial on Python. In this tutorial post, we are going to be discussing about the Python Tkinter PanedWindow Widget.
The Tkinter PanedWindow widget is a container widget that may contain any number of panes, that are either horizontally or vertically arranged.
Each pane contains one widget and each pair of the panes is separated by a movable sash. Moving a sash makes the widgets on either side of the sash to be resized.
The Tkinter PanedWindow widget is a container widget that may contain any number of panes, that are either horizontally or vertically arranged.
Each pane contains one widget and each pair of the panes is separated by a movable sash. Moving a sash makes the widgets on either side of the sash to be resized.
Syntax
The following below is the syntax for create this widget -
w = PanedWindow ( master, option=value, ... )
Parameter Details
- master - This represents the parent window.
- options - Following below is the list of commonly used options for this widget. These options can be used as key-value pairs that are separated by commas.
RECOMMENDED: Python GUI Programing with Tkinter
Sr.No. | Option & Description |
---|---|
1 |
bg
The color of the slider and arrowheads when the mouse is not over them.
|
2 |
bd
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.
|
3 |
borderwidth
Default is 2.
|
4 |
cursor
The cursor that appears when the mouse is over the window.
|
5 |
handlepad
Default is 8.
|
6 |
handlesize
Default is 8.
|
7 |
height
No default value.
|
8 |
orient
Default is HORIZONTAL.
|
9 |
relief
Default is FLAT.
|
10 |
sashcursor
No default value.
|
11 |
sashrelief
Default is RAISED.
|
12 |
sashwidth
Default is 2.
|
13 |
showhandle
No default value.
|
14 |
width
No default value.
|
RECOMMENDED: Python Tkinter Spinbox Widget
Methods
Following are the list of commonly used methods for this widget -
Sr.No. | Methods & Description |
---|---|
1 |
add(child, options)
Adds a child window to the paned window.
|
2 |
get(startindex [,endindex])
This method returns a specific character or a range of text.
|
3 |
config(options)
Modifies one or more widget options. If no options are given, the method returns a dictionary containing all current option values.
|
Example
Following is a simple example -
from Tkinter import * m1 = PanedWindow() m1.pack(fill=BOTH, expand=1) left = Label(m1, text="left pane") m1.add(left) m2 = PanedWindow(m1, orient=VERTICAL) m1.add(m2) top = Label(m2, text="top pane") m2.add(top) bottom = Label(m2, text="bottom pane") m2.add(bottom) mainloop()
Output
When the above code is executed, it will produce the following result -
RECOMMENDED: Python Tkinter Canvas Widget
Alright guys! This is where we are rounding up for this tutorial post. In our next tutorial, we are going to be discussing about the Python Tkinter LabelFrame Widget.
Feel free to ask your questions where necessary and i will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.
Feel free to ask your questions where necessary and i will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.
Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.
Thanks for reading and bye for now.