Building a Focus Timer App with Python & HTML

Building a Focus Timer App with Python & HTML

Why I Built This

As part of my journey learning Python and building real-world tools, I wanted to create something small but useful something that solves a real problem I face daily: staying focused.

The Focus Timer App is inspired by the Pomodoro technique. It helps you stay in the zone by timing work sessions and encouraging intentional breaks.

I built it with two parts:

  • A Command-Line Timer using Python
  • An Optional HTML/CSS UI for visual countdown

Let me walk you through it.


How It Works

🟢 From the terminal, the app prompts:

“How many minutes would you like to focus for?”

You type 25 (or any number), and the countdown begins right in your terminal.

Here’s what that looks like:

As time ticks down, it shows the exact time you’ll be done and updates the seconds live.

When time’s up, you get a message:

âś… Time’s up! Take a short break or start another session.


The Browser UI

For anyone not comfortable in the terminal—or if you just like visuals—I also created a super lightweight HTML version.

Just double-click ui.html or run open ui.html on Mac, and you’ll see this:

It starts at 25:00 and counts down when you click “Start.” Simple and clean.


Folder Structure

bashCopyEdit
focus_timer_app/
│
├── timer.py # Python CLI logic
├── ui.html # Lightweight browser UI
├── style.css # Styling for the UI
└── README.md # Project summary for GitHub

What I Learned

âś… Handling user input and validating it
âś… Using time.sleep(), datetime.now() and timers in Python
âś… Building responsive UI with just HTML/CSS
âś… How to break a project into small, testable parts
âś… Clean terminal output with emojis and formatting


Tools & Tech Used

  • Python 3.11
  • Terminal (macOS)
  • Sublime Text
  • HTML/CSS
  • Git + GitHub

Additional Learning Resources

Here are 3 beginner-friendly resources I recommend if you’re just getting into this:

  1. Python datetime Module Tutorial
  2. HTML/CSS Visual Timer Tutorial on YouTube
  3. Emojis in Python CLI (for fun visuals)

Final Thoughts

This was a fun and fast project, took me under an hour to build, test, and push to GitHub.

You can view the full source code here:
🔗 GitHub Repo – Focus Timer App

Let me know if you try it out or customize it into something even better!

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *