Python 3 Tkinter PanedWindow Widget Example to Display Multiple Panes or Panels in Horizontal or Vertical Direction GUI Desktop App Full Project For Beginners

Python 3 Tkinter PanedWindow Widget Example to Display Multiple Panes or Panels in Horizontal or Vertical Direction GUI Desktop App Full Project For Beginners

 

Welcome folks today in this post we will be building multiple panes or panels inside tkinter using panedwindow widget in python. All the full source code of the application is given below.

 

 

Get Started

 

 

In order to get started we need to make an app.py file and copy paste the following code

 

app.py

 

multiple panels or panes in vertical direction

 

from tkinter import *  

# event handler for button
def addition():  
    x = int(e1.get())  
    y = int(e2.get())  
    leftdata = str(x+y)  
    leftinput.insert(1, leftdata)  

# first paned window
w1 = PanedWindow()  
w1.pack(fill=BOTH, expand=1)  
  
leftinput = Entry(w1, bd=5)  
w1.add(leftinput)  
  
# second paned window
w2 = PanedWindow(w1, orient=VERTICAL)  
w1.add(w2)  
  
e1 = Entry(w2)
e2 = Entry(w2)
  
w2.add(e1)  
w2.add(e2)  
  
bottomBtn = Button(w2, text="Addition", command=addition)  
w2.add(bottomBtn)  
  
mainloop()

 

 

 

 

from tkinter import * 
from tkinter import ttk

win = Tk() 

pw = PanedWindow(orient ='vertical') 
#creating Button widget 
top = ttk.Button(pw, text ="Just Click Me!!!\nI am a Button") 
top.pack(side=TOP) 

#Adding button widget to the panedwindow 
pw.add(top) 

#Creating Checkbutton Widget 
bot = Checkbutton(pw, text="I am Checkbutton Choose Me!") 
bot.pack(side=TOP) 
pw.add(bot) 

label = Label(pw, text="I am a Label") 
label.pack(side=TOP) 

pw.add(label) 

string = StringVar() 

entry = Entry(pw, textvariable=string, font=('arial', 15, 'bold')) 
entry.pack() 

# This is used to force focus on particular widget 
# that means widget is already selected for some operations 
entry.focus_force() 

pw.add(entry) 
pw.pack(fill = BOTH, expand = True) 

# To show sash 
pw.configure(sashrelief = RAISED) 

mainloop()

 

See also  Python 3 Script to Automate PageSpeed Tests Using PageSpeed Insights API to Store Core Web Vitals Data inside CSV File Full Project For Beginners

 

Leave a Reply