Frontend Development 9 min read

Eight Python GUI Libraries for Building Desktop Applications

This article introduces eight Python GUI frameworks—including Tkinter, PyQt5, PySimpleGUI, Kivy, wxPython, Toga, Dear PyGui, and Streamlit—explaining their features, providing code examples, and offering a small exercise to create a simple calculator, helping developers quickly build desktop apps.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
Eight Python GUI Libraries for Building Desktop Applications

Hello everyone, today I will share a fun topic—Python desktop application development. Many think creating desktop apps is difficult, but Python makes it simple and efficient. I will introduce eight useful GUI libraries to help you build professional desktop applications.

1. Tkinter: Python's built‑in GUI toolkit

Tkinter is bundled with Python; its interfaces are basic but it is easy to learn, making it ideal for beginners.

import tkinter as tk
from tkinter import messagebox

# Create main window
window = tk.Tk()
window.title('My First GUI Program')
window.geometry('300x200')

# Create button callback
def show_message():
    messagebox.showinfo('Prompt', 'Hello, I am Tkinter!')

button = tk.Button(window, text='Click Me', command=show_message)
button.pack()

# Run the program
window.mainloop()

Tip: All Tkinter widgets need a parent container; use pack() , grid() , or place() to arrange them.

2. PyQt5: Professional‑grade GUI framework

PyQt5 is one of the most powerful GUI frameworks; it has a steeper learning curve but offers extensive functionality.

from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton
import sys

class MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.setWindowTitle('PyQt5 Example')
        self.setGeometry(100, 100, 300, 200)
        # Create button
        button = QPushButton('Click Me', self)
        button.move(100, 80)
        button.clicked.connect(self.button_clicked)

    def button_clicked(self):
        print('Button clicked!')

app = QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())

3. PySimpleGUI: Simplicity at its best

If you need to develop a quick, simple GUI, PySimpleGUI is the top choice.

import PySimpleGUI as sg

# Define layout
layout = [
    [sg.Text('Enter your name:')],
    [sg.Input(key='-NAME-')],
    [sg.Button('OK'), sg.Button('Exit')]
]

# Create window
window = sg.Window('Greeting', layout)

# Event loop
while True:
    event, values = window.read()
    if event in (None, 'Exit'):
        break
    if event == 'OK':
        sg.popup(f"Hello, {values['-NAME-']}!")

window.close()

4. Kivy: Modern cross‑platform GUI framework

Kivy can create both desktop and mobile applications with a flashy modern UI.

from kivy.app import App
from kivy.uix.button import Button

class MyApp(App):
    def build(self):
        return Button(text='Hello Kivy', font_size=30, on_press=self.btn_pressed)

    def btn_pressed(self, instance):
        print('Button pressed!')

if __name__ == '__main__':
    MyApp().run()

5. wxPython: Native‑style GUI toolkit

For applications that look native on each platform, wxPython is a solid option.

import wx

class MyFrame(wx.Frame):
    def __init__(self):
        super().__init__(parent=None, title='wxPython Example')
        panel = wx.Panel(self)
        # Create button
        self.button = wx.Button(panel, label='Click Me', pos=(100, 80))
        self.button.Bind(wx.EVT_BUTTON, self.on_click)
        self.Show()

    def on_click(self, event):
        wx.MessageBox('Hello wxPython!')

if __name__ == '__main__':
    app = wx.App()
    frame = MyFrame()
    app.MainLoop()

6. Toga: Native cross‑platform GUI toolkit

Toga, part of the BeeWare project, lets you build native applications with Python.

import toga
from toga.style import Pack
from toga.style.pack import COLUMN

class HelloWorld(toga.App):
    def startup(self):
        main_box = toga.Box(style=Pack(direction=COLUMN))
        button = toga.Button('Hello World', on_press=self.say_hello)
        main_box.add(button)
        self.main_window = toga.MainWindow(title=self.name)
        self.main_window.content = main_box
        self.main_window.show()

    def say_hello(self, widget):
        self.main_window.info_dialog('Hi there!', 'Hello, World!')

def main():
    return HelloWorld('Hello World', 'org.example.hello')

if __name__ == '__main__':
    main().main_loop()

7. Dear PyGui: High‑performance GUI library

When you need to visualize large data sets, Dear PyGui offers excellent performance.

import dearpygui.dearpygui as dpg

dpg.create_context()

def button_callback():
    print('Button clicked')

with dpg.window(label='Dear PyGui Example'):
    dpg.add_button(label='Click Me', callback=button_callback)

dpg.create_viewport(title='Custom Title', width=600, height=400)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

8. Streamlit: Rapid data‑app construction

Although primarily for web apps, Streamlit can also be used to build simple desktop tools.

import streamlit as st

st.title('Simple Streamlit App')

name = st.text_input('Enter your name')
if st.button('Greet'):
    st.write(f"Hello, {name}!")

Practical Exercise

Implement a simple calculator using your favorite GUI library. The interface should include numeric buttons, basic operators, clear and equals buttons, and support addition, subtraction, multiplication, and division.

Conclusion

The eight GUI libraries each have their own strengths:

Tkinter – easy entry point

PyQt5 – powerful features

PySimpleGUI – rapid development

Kivy – modern cross‑platform UI

wxPython – native look and feel

Toga – true native applications

Dear PyGui – high performance

Streamlit – data‑centric apps

Keep coding, ask questions in the comments, and enjoy your Python learning journey!

GUIPythonPyQt5TkinterStreamlitKivywxpython
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.