Using Separate Widget In Python GUI Application

Introduction

 
In this blog, I am going to create separate widgets in a Python GUI application. It will display the separate working frames on the application screen.
 
Software requirement
 
Python 3.5 and IDLE (Python 3.5)
 
Programming code
  1. #Create app using with separating widget  
  2. from tkinter import *  
  3. from tkinter import ttk  
  4. root=Tk()  
  5. #App Title  
  6. root.title("Python GUI Application ")  
  7. ttk.Label(root, text="Separating widget").pack()  
  8. #Create Panedwindow  
  9. panedwindow=ttk.Panedwindow(root, orient=HORIZONTAL)  
  10. panedwindow.pack(fill=BOTH, expand=True)  
  11. #Create Frams  
  12. fram1=ttk.Frame(panedwindow,width=100,height=300, relief=SUNKEN)  
  13. fram2=ttk.Frame(panedwindow,width=400,height=400, relief=SUNKEN)  
  14. panedwindow.add(fram1, weight=1)  
  15. panedwindow.add(fram2, weight=4)  
  16. #Calling Main()  
  17. root.mainloop()  
About the code
 
First, I am importing the tkinter modules.
 
Next, I have assigned a class and variables and given the application title.
 
Next, I have created a paned window and added two frames in the code.
 
Finally, I have started the Windows event loop by calling the mainloop method, then executed the code.
 
Now, let’s execute the code.
 
Output