Creating Your First GUI App with Flet and Python
Published on September 28, 2025
Welcome to your first look at building a modern GUI application using Flet, a fast-growing framework that lets you create rich, cross-platform apps entirely in Python, no HTML, CSS, or JavaScript required.
In this post, we’ll walk through the creation of a simple interactive counter app. This project will help you understand how Flet handles layout, state, and interactivity in a clean and Pythonic way.
Step 1: Installing Flet and Setting Up
To get started, install the Flet package using pip:
pip install flet
Now create a Python file, such as counter_app.py.
Step 2: Creating the Counter Interface
Flet uses a declarative syntax. Here's how we build the UI:
import flet as ft
def main(page: ft.Page):
counter = ft.Text(value="0", size=40)
def increment(e):
counter.value = str(int(counter.value) + 1)
page.update()
page.add(
ft.Column([
counter,
ft.ElevatedButton(text="Increment", on_click=increment)
], alignment="center", horizontal_alignment="center")
)
ft.app(target=main)
Step 3: Run the App
Run your script with:
python counter_app.py
A browser or native window will open with your working counter application.
Conclusion
You've just built a functional GUI application in Python with fewer than 20 lines of code. Flet makes it simple to create responsive interfaces, and this is only the beginning. Try adding reset functionality or explore Flet's built-in components to expand your app.