Prerequisites
Before you begin, ensure you have the following installed on your system:Python 3.9+
Download from python.org
pip
Package installer (included with Python)
Git
Version control system
Text Editor
VS Code, PyCharm, or your preferred editor
Python Arcade Suite requires Python 3.9 or higher. Check your version with
python --versionInstallation Steps
Clone the Repository
Clone the Python Arcade Suite repository to your local machine:This will create a
Python_Arcade directory containing all the source code.Create a Virtual Environment (Recommended)
It’s best practice to use a virtual environment to isolate project dependencies:
You’ll need to activate the virtual environment each time you work on the project.
Install Dependencies
Install the required Python packages using pip:This installs Streamlit and any other dependencies needed to run the games.
Project Structure
Understanding the codebase structure:Each game is modular with its own directory and
streamlit_game.py file containing the game logic and UI.Development Workflow
Making Changes
- Edit the code in your preferred text editor
- Save your changes - Streamlit will automatically detect changes
- The browser will show a “Source file changed” notification
- Click “Rerun” or press
Rto see your changes
Streamlit supports hot reloading, so you don’t need to restart the server for most changes.
Testing Your Changes
- Test each game individually through the sidebar menu
- Verify session state persistence by playing multiple rounds
- Check console output for any error messages
- Test in different browsers if needed
Stopping the Server
To stop the Streamlit server, pressCtrl+C in the terminal.
Configuration Options
Streamlit allows customization through.streamlit/config.toml:
Troubleshooting
Port Already in Use
If port 8501 is occupied:Module Import Errors
Problem:ModuleNotFoundError: No module named 'streamlit'
Solution:
- Ensure your virtual environment is activated
- Reinstall dependencies:
pip install -r requirements.txt - Verify Python version:
python --version
Game State Not Persisting
Problem: Game state resets unexpectedly Solution:- This is expected behavior when the page fully reloads
- Streamlit uses
st.session_statefor persistence between reruns - Check that session state variables are properly initialized
Streamlit Command Not Found
Problem:streamlit: command not found
Solution:
Python Version Issues
Problem: Compatibility errors with Python version Solution:- Ensure Python 3.9+ is installed:
python --version - Consider using pyenv to manage Python versions
Performance Tips
Use Caching
Leverage
@st.cache_data for expensive computationsOptimize Reruns
Minimize operations in the main script body
Session State
Store only necessary data in session state
Clear Cache
Use
streamlit cache clear if neededNext Steps
Deploy to Streamlit Cloud
Learn how to deploy your app to production
Streamlit Documentation
Explore Streamlit’s official documentation