Skip to content

itsvaibhavi13/Connect4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Connect 4 – Python Tkinter GUI

A fully playable Connect 4 game built in Python using Tkinter.
The project features a main menu window and a separate game window, demonstrating event-driven programming, GUI design, and structured game logic.

Overview

This project implements the classic Connect 4 game with a graphical user interface.
The application launches with a main menu, from which players can start a new game. Each game runs in its own window, handling turn-based gameplay and win detection.

Features

  • 🎮 Classic Connect 4 gameplay
  • 🖥️ Graphical interface built with Tkinter
  • 🪟 Separate main menu and game window
  • 👥 Two-player local mode
  • 🔄 Turn tracking and visual player indicators
  • ✅ Win detection logic
  • 🧠 Modular design with separated responsibilities

Tech Stack

  • Language: Python 3
  • GUI: Tkinter (standard Python library)
  • Libraries: No third-party libraries required

Project Structure

  • main.py – Application entry point
  • window1.py – Main menu window (start screen)
  • game.py – Game window and core game logic
  • README.md – Project documentation

How It Works

main.py

Acts as the entry point of the application and launches the main window.

window1.py

Contains the MainWindow class, which displays the title screen and allows the user to start a new game.

game.py

Contains the Game class, responsible for:

  • Creating the game window
  • Managing the board state
  • Handling player turns
  • Detecting win conditions

This separation improves readability, maintainability, and scalability.

Getting Started

Prerequisites

  • Python 3.8+
  • Tkinter (included with most Python installations)

Running the Game

Clone the repository:

git clone https://github.com/your-username/connect-4-tkinter.git
cd connect-4-tkinter

Gameplay Rules

  • Players take turns dropping discs into one of the columns.
  • Discs fall to the lowest available slot.
  • The first player to connect four discs in a row (horizontal, vertical, or diagonal) wins.
  • A game window displays the current player’s turn and the game outcome.

Concepts Demonstrated

  • Object-oriented programming in Python
  • Event-driven GUI programming
  • Multi-window Tkinter applications
  • Game state management
  • Clean separation of UI and logic
  • Use of class variables and instance state

About

This is a clone of the Connect 4 game

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages