Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Turtle
  • Python PIL
  • Python Program
  • Python Projects
  • Python DataBase
  • Python Flask
  • Python Django
  • Numpy
  • Pandas
  • Python Database
  • Data Science With Python
  • Machine Learning with Python
  • Django
  • Flask
  • R
Open In App
Next Article:
Python Tkinter
Next article icon

Python GUI – PyQt VS TKinter

Last Updated : 11 Dec, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report

 A GUI toolkit contains widgets that are used to create a graphical interface. Python includes a wide range of Interface implementations available, from TkInter (it comes with Python, ) to a variety of various cross-platform solutions, such as PyQt5, which is known for its more sophisticated widgets and sleek look. 

PyQt

PyQt is a toolkit for graphical user interface (GUI) widgets. It is extracted from the library of Qt. PyQt is the product of the combination of the Python language and the Qt library. PyQt is coming with the Qt Builder. We will use it to get the python code from the Qt Creator. With the support of a qt designer, we can build a GUI, and then we can get python code for that GUI. PyQt supports all platforms including Windows, macOS and UNIX. PyQt can be used to create stylish GUIs, a modern and portable python framework. 

Code:

Python3

# Import sys for handle the 
# exit status of the application.
import sys
  
# Importing required widgets
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWidgets import QLabel
from PyQt5.QtWidgets import QWidget
  
# To create an instance of QApplication
# sys.argv contains the list of
# command-line argument
app = QApplication(sys.argv)
  
# To create an instance of application GUI
# root is an instance of QWidget,
# it provides all the features to
# create the application's window
root = QWidget()  
  
# adding title to window
root.setWindowTitle('Geeks App') 
  
# to place txt at the coordinates
root.move(60, 15) 
  
# to display text
txt = QLabel('Welcome, Geeks!', parent = root) 
txt.move(60, 15)
  
# Show application's GUI
root.show()
  
# Run application's main loop
sys.exit(app.exec_())
                      
                       

Output:

A simple app to display text using PyQt.

Advantages of using PyQt

  • Coding versatility –GUI programming with Qt is built around the idea of signals and slots for creating contact between objects. This allows versatility in dealing with GUI incidents which results in a smoother code base.
  • More than a framework : Qt uses a broad variety of native platform APIs for networking, database development, and more. It provides primary access to them through a special API.
  • Various UI components:  Qt provides multiple widgets, such as buttons or menus, all designed with a basic interface for all compatible platforms.
  • Various learning resources:  As PyQt is one of the most commonly used UI systems for Python, you can conveniently access a broad variety of documentation.

Disadvantages of using PyQt

  • Lack of Python-specific documentation for classes in PyQt5
  • It takes a lot of time to grasp all the specifics of PyQt, meaning it’s a pretty steep learning curve.
  • If the application is not open-source, you must pay for a commercial license.

Tkinter

Tkinter is an open-source Python Graphic User Interface (GUI) library well known for its simplicity. It comes pre-installed in Python, so you don’t even need to think about installing it. These characteristics make it a strong position for beginners and intermediates to begin with. Tkinter cannot be used for larger-scale projects.

Code:

Python3

# importing the module tkinter
import tkinter as tk
  
# create main window (parent window)
root = tk.Tk()
  
# Label() it display box
# where you can put any text. 
txt = tk.Label(root,
               text="Welcome to GeekForGeeks")
  
# pack() It organizes the widgets
# in blocks before placing in the parent widget.
txt.pack()
  
# running the main loop
root.mainloop()
                      
                       

Output:

A simple app to display text using tkinter.

Advantages of using Tkinter

  • Tkinter is easy and fast to implement as compared to any other GUI toolkit.
  • Tkinter is more flexible and stable.
  • Tkinter is included in Python, so nothing extra need to download.
  • Tkinter provides a simple syntax.
  • Tkinter is really easy to understand and master.
  • Tkinter provides three geometry managers: place, pack, and grid. That is much more powerful and easy to use.

Disadvantages of using Tkinter

  • Tkinter does not include advanced widgets.
  • It has no similar tool as Qt Designer for Tkinter.
  • It doesn’t have a reliable UI.
  • Sometime, it is hard to debug in Tkinter.
  • It is not purely Pythonic.

Difference between PyQt and Tkinter

No.Basis

PyQt

Tkinter

1.LicensePyQt is available under Riverbank Commercial License and GPL v3 (General Public License v 3.0) and if you do not wish to release your application under a GPL-compatible license, you must apply for a commercial license. Tkinter is open source and free for any commercial use.
2.Ease of UnderstandingIt requires a lot of time for understanding all the details of PyQt.Tkinter is easy to understand and master due to a small library.
3.DesignPyQt has a modern look and a good UI.Tk had an older design and it looks outdated.
4.WidgetsthenPyQt comes with many powerful and advanced widgets.  TkInter does not come with advanced widgets.
5.UI BuilderPyQt have a Qt Designer tool which we can use to build GUIs than get python code of that GUI using Qt Designer.It has no similar tool as Qt Designer for Tkinter.
6.InstallationPyQt is not included by default with Python installations.It is included in the standard Python library so no need to install it separately.


Next Article
Python Tkinter

A

amnindersingh1414
Improve
Article Tags :
  • Difference Between
  • Python
  • Python-gui
  • Python-PyQt
  • Python-tkinter
Practice Tags :
  • python

Similar Reads

  • Python Tkinter
    Python Tkinter is a standard GUI (Graphical User Interface) library for Python which provides a fast and easy way to create desktop applications. Tkinter provides a variety of widgets like buttons, labels, text boxes, menus and more that can be used to create interactive user interfaces. Tkinter sup
    12 min read
  • Python Tkinter Mainloop
    Tkinter is the standard GUI (Graphical User Interface) library for Python. It provides a powerful object-oriented interface to the Tk GUI toolkit. Understanding how the mainloop works in Tkinter is essential for creating responsive and interactive applications. This article delves into the intricaci
    3 min read
  • Python Tkinter - Message
    Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter is the fastest and easiest way to create GUI applicat
    3 min read
  • Tic Tac Toe Game using PyQt5 in Python
    In this article , we will see how we can create a Tic Tac Toe game using PyQt5. Tic-tac-toe, noughts, and crosses, or Xs and Os is a paper-and-pencil game for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three of their marks in a horizonta
    5 min read
  • What is Tkinter for Python?
    Tkinter is a standard Python GUI (Graphical User Interface) library that provides a set of tools and widgets to create desktop applications with graphical interfaces. Tkinter is included with most Python installations, making it easily accessible for developers who want to build GUI applications wit
    2 min read
  • Geometry Method in Python Tkinter
    Tkinter is a built-in Python module used for building desktop GUI applications. It's simple, powerful, and doesn’t require any external installation. Tkinter provides many methods, one of them is the geometry() method and it is used to control the size and position of the GUI window. The geometry()
    2 min read
  • Python Tkinter - Entry Widget
    Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. Python with Tkinter is the fastest and easiest way to create GUI applications. Creating a GUI using Tkinter is an easy task.In Python3 Tkinter is come
    5 min read
  • How to use HTML in Tkinter - Python?
    Prerequisite: Tkinter Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter is the fastest and easiest way to
    2 min read
  • Python | after method in Tkinter
    Tkinter provides a variety of built-in functions develop interactive and featured GUI (Graphical User Interface). after() function is also a Universal function which can be used directly on the root as well as with other widgets. after(parent, ms, function = None, *args) Parameters: parent: is the o
    2 min read
  • PyQt5 QtSql - Python
    PyQt provides us UI features which can be useful in number of ways to build our applications using all the features and widgets of PyQt. Moreover PyQt provides us the facility to integrate our database in our application. We can integrate any database through it some of them are- MySQL, SQLITE etc.
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences