A Wordle-style word guessing game with Pygame UI
Project description
Words Guessing Game - Pygame UI Version
A Wordle-style word guessing game with a graphical user interface built using Pygame.
Features
- Wordle-inspired visual design with color-coded feedback
- Dual input system: Use physical keyboard or on-screen virtual keyboard
- Customizable difficulty: Choose attempts (1-10) and word length (3-11)
- Color-coded feedback:
- 🟩 Green: Letter in correct position
- 🟨 Yellow: Letter in word but wrong position
- ⬜ Gray: Letter not in word
- Virtual keyboard tracking: See which letters you've tried and their status
Requirements
- Python 3.7+
- pygame
- nltk (already installed for the console version)
Installation
If pygame is not installed, run:
pip install pygame
How to Run
Pygame UI Version (NEW):
python game_with_ui.py
Original Console Version:
python start_game.py
How to Play
-
Setup Screen:
- Select the number of attempts (1-10)
- Select word length (3-11 characters)
- Click "START GAME"
-
Game Screen:
- Type your guess using your keyboard OR click letters on the virtual keyboard
- Press ENTER or click "SUBMIT" to submit your guess
- Watch the color-coded feedback:
- Green tiles: Correct letter in correct position
- Yellow tiles: Correct letter in wrong position
- Gray tiles: Letter not in the word
- Press ESC to restart the game
-
End Screen:
- See your final result (Win or Lose)
- View the correct word
- Click "PLAY AGAIN" to start a new game
- Click "EXIT" to quit
Game Rules
- Words must be exactly the length you selected
- Words must contain only English letters (A-Z)
- Words must be in the English dictionary
- You have a limited number of attempts based on your selection
Controls
Physical Keyboard:
- A-Z: Type letters
- BACKSPACE: Delete last letter
- ENTER: Submit guess
- ESC: Return to setup screen
Mouse:
- Click on virtual keyboard letters
- Click "SUBMIT" button to submit guess
- Click "←" button to delete last letter
File Structure
FirstGame/
├── game_with_ui.py # Main pygame entry point (NEW)
├── start_game.py # Original console version
├── ui/ # UI components (NEW)
│ ├── __init__.py
│ ├── constants.py # Colors, dimensions, fonts
│ ├── ui_components.py # Reusable UI components
│ ├── setup_screen.py # Setup screen
│ ├── game_screen.py # Main game screen
│ └── end_screen.py # Win/loss screen
└── functions/ # Game logic (unchanged)
├── find.py
├── print.py
├── validation.py
├── UserInputIntReader.py
└── nltk_functions.py
Technical Notes
- The pygame UI reuses all existing game logic from the
functions/directory - The original console version (
start_game.py) remains fully functional - NLTK word dictionary will download automatically on first run (if not already cached)
- Screen size: 600x800 pixels
- FPS: 60
Tips
- Start with easier settings (6 attempts, 5-letter words) to get familiar with the game
- Watch the virtual keyboard to track which letters you've already tried
- Common letters like E, A, R, I, O, T are good starting guesses
Troubleshooting
Issue: Game window doesn't open
- Make sure pygame is installed:
pip install pygame - Check that your Python version is 3.7 or higher
Issue: "Word not in dictionary" error for common words
- The game uses NLTK's English word corpus
- Make sure NLTK data is downloaded (happens automatically on first run)
Issue: Slow performance
- Try reducing word length or attempts if on older hardware
- The game runs at 60 FPS on most modern systems
Credits
Created using:
- Pygame: Game framework
- NLTK: English word dictionary
- Inspired by Wordle
Enjoy the game!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file words_guessing_game_banbar1-0.0.1.tar.gz.
File metadata
- Download URL: words_guessing_game_banbar1-0.0.1.tar.gz
- Upload date:
- Size: 47.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88e6e39b9d62ab953a5bf2db6286bdae4bd4e8265a1a200120b2f1a5e7fcb06c
|
|
| MD5 |
8f91d01a41d3c814676d9dd713b9f185
|
|
| BLAKE2b-256 |
d3e21deeb6728148d76bd7f2d982056d1614274f40fd12dea791beaf403a6d42
|
File details
Details for the file words_guessing_game_banbar1-0.0.1-py3-none-any.whl.
File metadata
- Download URL: words_guessing_game_banbar1-0.0.1-py3-none-any.whl
- Upload date:
- Size: 47.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14724ca0798fd3a34a26de5bcd71889d5c792e05ca5e57c2b8dac0c97d41c0a5
|
|
| MD5 |
cb15c1444e05307852e7bda53e3be22e
|
|
| BLAKE2b-256 |
894d629bce13bec7b0b09f14be9ef8de5d64197e323de30b53a2805b1c315546
|