Skip to content

A simple word guessing game which involves you to guess the whole word where you have 6 lives. Both app version and terminal version are available for you to play.

Notifications You must be signed in to change notification settings

KshavCode/hangman-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hangman

A small, beginner-friendly word guessing game implemented in Python. The game offers two play modes: a GUI version using Tkinter and a simple terminal (CLI) version. You have 6 lives to guess the word, and incorrect guesses reduce your remaining lives.

Highlights

  • Simple and portable Python code.
  • GUI built with tkinter and uses images for the hangman states.
  • Terminal mode included for quick play and testing.

Requirements

  • Python 3.8+ (tested with Python 3.11)
  • Pillow (for GUI image handling)

Install the required package:

pip install pillow

Quick Start

  • Clone or download the project and open the project folder.
  • Ensure words.txt contains the words you want the game to choose from (one or more words separated by whitespace).

GUI (Tkinter)

  1. Run the GUI app:
python app.py
  1. A window will open showing the hangman image, blank spaces for the word, and letter buttons. Click letters to guess. The game ends when you guess the word or run out of lives.

Terminal (CLI)

  1. Run the module directly:
python hangman_init.py
  1. Follow the prompts in the terminal to guess single letters.

File overview

  • app.py — GUI entry point using tkinter and Pillow.
  • hangman_init.py — Game logic and terminal gameplay loop.
  • words.txt — Word list used by the game (one or more words separated by spaces/newlines).
  • images/ — PNG images for hangman states (0..6) used by the GUI.
  • README.md — This file.

Customizing the word list

  • Edit words.txt to add or remove words. Each word can be separated by spaces or new lines. The game picks random words from this file.

Notes & Tips

  • For best results in the GUI, keep the images folder intact with the required 0.png through 6.png images.
  • The code is lightweight and intended for learning; feel free to refactor or enhance (difficulty levels, scoring, save/load, multiplayer, etc.).

Contributing

  • Small fixes, improvements and images are welcome. Open a PR or edit locally and commit.

License

  • This repository has no explicit license file. If you plan to share it publicly, consider adding an OSI-compatible license (for example, MIT) to clarify reuse terms.

About

A simple word guessing game which involves you to guess the whole word where you have 6 lives. Both app version and terminal version are available for you to play.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages