A simple web application that simulates flipping a coin, built using the Rio web framework for Python.
- Python 3.7 or higher
- pip (Python package installer)
-
Create and activate a virtual environment (recommended):
python -m venv venv source venv/bin/activate # On Windows, use: venv\Scripts\activate
-
Install Rio UI framework:
pip install rio-ui
coin_flipper/
├── __init__.py # App initialization
├── components/
│ ├── __init__.py
│ └── coin.py # Coin component
├── pages/
│ └── coin_flipper_page.py # Main page
└── rio.toml # Rio configuration
-
Make sure you're in the project root directory (where rio.toml is located)
-
Run the application using Rio:
python -m rio run
-
Open your web browser and navigate to the URL shown in the console (typically http://127.0.0.1:XXXXX, where XXXXX is the port number)
- Interactive coin flipping
- Animated coin transitions
- Real-time result display
- Reset functionality
- Clean, responsive design
The application is built using Rio's component-based architecture:
-
Main Page Component (CoinFlipperPage):
- Manages the game state
- Handles coin flip logic
- Displays results and messages
-
Coin Component:
- Handles coin display and animation
- Shows different states (initial, flipping, result)
- Responds to user interaction
-
Interactive Features:
- Click the coin to flip it
- Animated transition during flips
- Clear result display
- Reset option to start over
The application runs in debug mode by default, which is helpful for development. For production use, add the --release flag:
python -m rio run --release
You can customize the application by:
- Modifying the coin animations
- Changing the coin display icons
- Adjusting timing and transitions
- Adding additional features like statistics
If you encounter any issues:
-
Make sure all dependencies are installed:
pip install rio-ui
-
Check that you're running the command from the project root directory (where rio.toml is located)
-
Verify that the port is not in use by another application
-
If you see import errors, make sure your Python environment is activated and Rio is installed correctly
- Built with Rio web framework
- Component-based architecture
- Real-time state management
- Responsive design
- Debug and release modes
- Built-in development server