You are browsing as a guest. Sign up (or log in) to start making projects!

Desktop Vending Cat

  • 1 Devlogs
  • 2 Total hours

A desktop vending machine cat companion.

Ship #1 Changes requested

Desktop Cat Vending Machine

This project is an interactive desktop widget built in Python using Tkinter. The application runs as a frameless, transparent overlay pinned above your active windows.

When a user left-clicks the vending machine, it runs a brief vending machine like shake animation and dispenses a random cat image pulled from a local asset folder. The dispensed images automatically disappear after 5 seconds or close immediately when clicked.

Primary Challenges:
The main challenge was ensuring the application could reliably locate its image assets when executed on other devices or compiled into a standalone binary. Standard relative pathing broke depending on the user's working directory, but I resolved this by using an environment-aware utility that checks sys.frozen to toggle the asset lookup root between the local script file and the compiled executable path.

Input Spamming: Rapidly clicking the widget queued multiple overlapping movement instructions, causing the layout to be distorted. I fixed this by introducing a state lock that ignores incoming click inputs while a dispense animation sequence is actively running.

What are you proud of?
Instead of building a fragile script that crashes under unexpected conditions, if the image directory is missing, empty, or contains corrupted files, a try-except block intercepts the failure and falls back to a procedurally generated default text UI. I also ensured that window creation and destruction properly clear memory references to prevent resource leaks during extended use. This might be a standard feature, but as a very beginner python programmer, it's something I'm still relatively proud of.

Controls: Left-click the vending machine to dispense an item. Left-click the spawned image to dismiss it early. Right-click the vending machine to close the application entirely.

Customization: The application scans the cat_library directory dynamically. You can add, remove, or change the contents of this folder with your own images (.png, .jpg, .gif, etc.) to modify what the machine dispenses.

Environment: If running from the source code, ensure you have Python 3 installed and have run pip install Pillow to handle the graphic resizing. Otherwise, launch the standalone executable directly.

Finally, this project was made the day before my friend's birthday as a mildly crammed last-minute gift. So, keep this on your own desktop for a cat companion while you work, or share some cats with your friends as well.

  • 1 devlog
  • 2h
Try project → See source code →
Open comments for this post

1h 40m 29s logged

Don’t have a cat? This project will give you 70 random ones, for 5 seconds each.

My friend’s birthday is tomorrow. I am too broke to buy a gift, so I made this project in one sitting. That is why there is only one devlog (apologies Hackclub staff) and much less time logged than I actually spent on it (~4.5 hours).

I often get sent cat reels from him, so I decided to bring the cats directly to his desktop: through a desktop-pet style vending machine that dispenses random cats (with a kirby easter egg).

This project was made in python using tkinter for desktop applications and Pillow for advanced image resizing and rendering.

Most of the trials and tribulations came from getting the vending machine animation to look right and the cat library to be actually accessed instead of always falling back on the try catch.

Anyway, here is a cat vending machine.

0
0
3

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…