← Go Back

How to Create a Desktop Application

There are multiple libraries to develop graphic applications in Python. Among the most popular and fruitful are Qt, GTK+ and wxWidgets. Python includes a fourth one called Tcl/Tk in the standard library. The Python bindings corresponding to these libraries (since they are written in C or C++) are:


Programming desktop applications in Python orbits around these four cross-platform solutions. Without a doubt Tcl/Tk is a good solution to start or develop small and medium-sized applications. Qt, GTK+ and wxWidgets are capable of building large and complex interfaces. IronPython users have access to WPF, although the technology is only supported on Windows.

For example, the following code creates a small window with some widgets using Tcl/Tk:

import tkinter as tk
from tkinter import ttk

root = tk.Tk()
root.config(width=350, height=250)
root.title("Desktop App with Tcl/Tk")
button = ttk.Button(text="Hello world!")
button.place(x=50, y=50)
textbox = ttk.Entry()
textbox.insert(0, "Enter your name...")
textbox.place(x=50, y=100)
checkbox = ttk.Checkbutton(text="Option 1")
checkbox.place(x=50, y=150)
root.mainloop()



desktop-applications


🐍 You might also find interesting: