š Tamagotchi in Streamlit
- Alvaro Mejia
- May 30, 2025
- 2 min read
š¾ Tamagotchi Web App ā Practicing OOP and Interactive UI in Python
This project is a web-based Tamagotchi gameĀ I built using Python and Streamlit. The goal was to create a fun and interactive way to apply concepts of Object-Oriented Programming (OOP), build an event-driven UI, and manage stateful logicĀ within a lightweight web framework.
šÆ Project Goals
Practice OOP designĀ by creating a class-based virtual pet
Implement a modular and scalable architectureĀ using separate files for logic, config, and visuals
Use StreamlitĀ to create an interactive, browser-based interface
Learn to manage user state (st.session_state)Ā to simulate memory and game persistence
Deploy a project that is both technicalĀ and accessible
š§ What I Built
A TamagotchiĀ class with attributes like hunger, boredom, tiredness, and dirtiness
Methods like .eat(), .play(), .sleeping(), and .bath()Ā that affect pet status
A death()Ā method that ends the game if any parameter reaches 10
A rock-paper-scissors mini-gameĀ to reduce boredom, fully playable with buttons
Dynamic stats visualized with Plotly charts
A message screenĀ that shows real-time feedback and actions
Support for game-over handlingĀ and restarting the game
A separate Instructions pageĀ built with Streamlit's multi-page support
š ļø Tools & Tech
Python 3.10
StreamlitĀ for web UI
Plotly ExpressĀ for interactive visualizations
PandasĀ for handling time-series-like game history
HTML + MarkdownĀ for layout styling
šø Screenshots




š What I Learned
This project helped me reinforce:
OOP design patternsĀ (attributes, encapsulation, methods)
How to design a modular Python projectĀ with clean structure
Managing UI state in StreamlitĀ without a backend
Interactive game logicĀ with immediate feedback to the user
Basic frontend experienceĀ (icons, layout, user flow)
š Why It Matters
Although Tamagotchi isn't a Data Science project directly, it demonstrates my ability to:
Build maintainable, interactive Python applications
Think in terms of user experienceĀ and workflow
Apply programming principles in a creative and engaging way
Work with Streamlit, a tool I also use for Data Science dashboards and apps
š Live Demo & Code
GitHub Repo: github.com/mgalvaro/tamagotchi
Live Demo: https://tamagotchi-amg.streamlit.app/





Comments