
- Python 3 Basic Tutorial
- Python 3 - Home
- What is New in Python 3
- Python 3 - Overview
- Python 3 - Environment Setup
- Python 3 - Basic Syntax
- Python 3 - Variable Types
- Python 3 - Basic Operators
- Python 3 - Decision Making
- Python 3 - Loops
- Python 3 - Numbers
- Python 3 - Strings
- Python 3 - Lists
- Python 3 - Tuples
- Python 3 - Dictionary
- Python 3 - Date & Time
- Python 3 - Functions
- Python 3 - Modules
- Python 3 - Files I/O
- Python 3 - Exceptions
- Python 3 Advanced Tutorial
- Python 3 - Classes/Objects
- Python 3 - Reg Expressions
- Python 3 - CGI Programming
- Python 3 - Database Access
- Python 3 - Networking
- Python 3 - Sending Email
- Python 3 - Multithreading
- Python 3 - XML Processing
- Python 3 - GUI Programming
- Python 3 - Further Extensions
- Python 3 Useful Resources
- Python 3 - Questions and Answers
- Python 3 - Quick Guide
- Python 3 - Tools/Utilities
- Python 3 - Useful Resources
- Python 3 - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python 3 - Tkinter PanedWindow
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.
Syntax
Here 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.
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. |
9 | height No default value. |
10 | orient Default is HORIZONTAL. |
11 | relief Default is FLAT. |
12 | sashcursor No default value. |
13 | sashrelief Default is RAISED. |
14 | sashwidth Default is 2. |
15 | showhandle No default value |
16 | width No default value. |
Methods
PanedWindow objects have these methods −
Sr.No. | Method & 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
Try the following example yourself. Here's how to create a 3-pane widget −
# !/usr/bin/python3 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()
Result
When the above code is executed, it produces the following result −
