A desktop online voting application built with Python and Tkinter. It simulates a secure election workflow with voter registration, OTP verification, socket-based vote submission, and an admin dashboard for managing elections.
Portfolio project — demonstrates GUI development, client–server networking, CSV-based data persistence, and email-based two-factor authentication.
- Voter portal — Login with voter ID and password, OTP verification via email, and cast a vote for one of five options (BJP, Congress, AAP, Shiv Sena, NOTA)
- Admin dashboard — Register voters, view live results, start/stop the voting server, and reset election data
- Socket server — Threaded TCP server handles authentication and vote recording with concurrency control
- OTP security — One-time passwords sent over SMTP before a vote is accepted
- Election chatbot — Built-in help chatbot on the home screen
- CSV database — Lightweight voter and candidate storage using pandas
| Layer | Technology |
|---|---|
| Language | Python 3.10+ |
| GUI | Tkinter |
| Networking | socket, threading |
| Data | pandas, CSV files |
| smtplib + Gmail App Passwords | |
| Images | Pillow (PIL) |
| Process management | psutil |
Online-Voting-System/
├── main.py # Application entry point
├── splash.py # Splash screen
├── homePage.py # Home page and navigation
├── voter.py # Voter login and OTP flow
├── VotingPage.py # Ballot / vote casting UI
├── Admin.py # Admin login and dashboard
├── registerVoter.py # Voter registration form
├── admFunc.py # Admin utilities (results, reset)
├── Server.py # Voting socket server (port 4001)
├── dframe.py # Database / CSV operations
├── email_utils.py # OTP generation and email delivery
├── database/
│ ├── voterList.csv # Registered voters (demo data)
│ └── cand_list.csv # Candidates and vote counts
├── img/ # UI assets (party logos, backgrounds)
├── requirements.txt
├── .env.example # SMTP configuration template
└── Report.pdf # Project documentation
- Python 3.10 or newer
- pip
-
Clone the repository
git clone https://github.com/<your-username>/Online-Voting-System.git cd Online-Voting-System
-
Create and activate a virtual environment (recommended)
python -m venv .venv # Windows .venv\Scripts\activate # macOS / Linux source .venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Configure email (required for OTP voting)
copy .env.example .env # Windows cp .env.example .env # macOS / Linux
Edit
.envwith your SMTP credentials. For Gmail, create an App Password and use it asSMTP_APP_PASSWORD..envis gitignored and will not be committed.
-
Start the app:
python main.py
-
Start the voting server (required before voters can log in):
- Go to Admin Login → log in → click Start Server
- Or run the server manually:
python Server.py
-
Cast a vote:
- Go to Voter Login
- Use demo credentials (see below)
- Enter the OTP sent to the voter's registered email
- Select a candidate and submit
| Role | ID / Username | Password |
|---|---|---|
| Admin | Admin |
admin |
| Voter 1 | 10001 |
voter123 |
| Voter 2 | 10002 |
voter456 |
Demo voter emails use @example.com addresses. Replace them with real emails in database/voterList.csv (or register new voters via the admin panel) when testing OTP delivery.
- The admin starts
Server.py, which listens on port 4001. - A voter logs in; credentials are checked against
voterList.csv. - An OTP is emailed to the voter's registered address.
- After OTP verification, the client sends credentials to the server for authentication.
- The vote is transmitted over the socket and written to the CSV files under a thread lock.
This project is intended for learning and portfolio demonstration. For a production election system you would need:
- Hashed passwords (not plain text)
- A real database with transactions
- HTTPS/TLS and certificate-based auth
- Audit logs, rate limiting, and tamper-proof storage
- OTP storage with expiration in a secure backend
Important: Never commit .env or real SMTP credentials to GitHub. If credentials were ever exposed, revoke them immediately in your Google Account settings.
Abhit Kunkalkar
Built as part of a college / personal portfolio project — LoKMat Election Commission simulation.