Tkinter

PanedWindow Tkinter | Python 3

In this tutorial, we are going to see how to use PanedWindow in Tkinter. A PanedWindow is a container widget that can contain any number of panels, arranged horizontally or vertically.

The PanedWindow widget is a widget that can contain one or more child widgets (panes). The child widgets can be resized by the user, by moving the separating lines with the mouse.
 

 

 

Syntax:

Here is the syntax to create this widget:

pw = PanedWindow ( master, option = value, ... )

 

Parameters:
  • master : This represents the parent window.
  • options : See below for a list of the most commonly used options for this widget. These options can be used as comma separated key-value pairs.

 

 

Example: PanedWindow Tkinter
from tkinter import *

pw1 = PanedWindow()
pw1.pack(fill=BOTH, expand=1)

left = Label(pw1, text="Left pane")
pw1.add(left)

pw2 = PanedWindow(pw1, orient=VERTICAL)
pw1.add(pw2)

top = Label(pw2, text="Top pane")
pw2.add(top)

bottom = Label(pw2, text="Bottom pane")
pw2.add(bottom)

mainloop()

Output:


 
 

PanedWindow options
Option
Description
bd Border width in pixels. The default value is 2.
bg Background color.
borderwidth Default value is 2.
cursor The cursor that shows up when the mouse hovers over the window.
handlepad Default value is 8.
handlesize Default value is 8.
height No default value.
orient Default value is HORIZONTAL.
relief The default value is FLAT.
sashcursor No default value.
sashrelief The default value is RAISED.
sashwidth The default value is 2.
width No default value.

 

Methods:

Here are the commonly used methods for this widget:

Method
Description
add(child, options) Adds a child window to the window that contains the panel.
config(options) Changes one or more widget options. If no options are given, the method returns a dictionary containing all current option values.

 

mcqMCQPractice competitive and technical Multiple Choice Questions and Answers (MCQs) with simple and logical explanations to prepare for tests and interviews.Read More

Leave a Reply

Your email address will not be published. Required fields are marked *