A modular, multi-window desktop application developed using Python,
tkinter, and thettkthemed widget extension. It interfaces dynamically with a remote or local MySQL server cluster. The architecture separates the graphical front-end logic into discrete execution scripts which communicate with the database via parameterized queries provided by themysql-connector-pythonAPI.
Tip
This is an improvised, feature-rich version of my old election software. Originally created for my school and used for four consecutive years (2023-2026) at the time of writing this (June 2026).
If you would still like to view the older version, check out Naresh-x86/Polling-Application!
The application logic heavily relies on dynamic schema retrieval and strict connection handling.
sequenceDiagram
participant User
participant AppLauncher
participant MySQL
participant LoginProcess
User->>AppLauncher: Execute Script
AppLauncher->>MySQL: Attempt Connection (config.json)
alt Connection Success
MySQL-->>AppLauncher: Socket Established
AppLauncher->>MySQL: SHOW DATABASES
MySQL-->>AppLauncher: Array of Schemas
else Error 1045 (Auth Failure)
MySQL-->>AppLauncher: Access Denied
AppLauncher->>LoginProcess: subprocess.Popen('Login.exe')
LoginProcess-->>User: Request Admin Credentials
else Error 2003 (Server Offline)
MySQL-->>AppLauncher: Connection Refused
AppLauncher-->>User: tkinter.messagebox Alert
end
-
JSON Configuration Parsing
On initialization, scripts parseconfig.jsonto extract connection parameters (host, user, password, database). -
Dynamic Enumeration
Upon a successful socket connection, the system executesSHOW DATABASES. The resulting tuple list is parsed and injected directly into thevaluesargument of attk.Combobox, allowing the user to select the target schema dynamically at runtime.
| Executable | Role | Technical Description |
|---|---|---|
AppLauncher.py |
Entry Point | Handles connection validation, dynamic database selection, and applies custom styling rules using ttk.Style (clam theme with modified fieldbackground and selectforeground hex values). |
ManageDatabase.py |
Admin Console | Queries the config.json's posts array to identify target tables. Implements file dialogs (tkinter.filedialog.askopenfilename) to upload candidate imagery, loading paths as strings into the database while rendering local copies via PIL. |
application.py |
Voter Terminal | Queries target tables, renders candidate data structures, and commits parameterized UPDATE statements to increment vote indices. Contains logic for audio playback (vote.mp3). |
The software employs absolute positioning (.place()) on high-resolution canvas elements.
Note
It implements a custom module, shared.windows_font_installer, which parses the local OS font registry and temporarily loads specific TrueType/OpenType files (e.g., 'Dubai') into the session memory, ensuring cross-platform typographical consistency without requiring administrative system-level font installations.
Caution
Ensure a MySQL Server instance is running locally or remotely and is reachable by the host machine.
-
Dependency Installation Initialize a virtual environment and install the required packages:
pip install mysql-connector-python Pillow
-
Configuration Copy
(example) config.jsontoconfig.jsonand update the connection parameters to match your MySQL environment:{ "host": "localhost", "user": "root", "password": "yourpassword", "database": "polling_db" } -
Launch the System Run the application launcher to start the voting terminal:
python AppLauncher.py
Note
No Artificial Intelligence or automated code generation tools were utilized in the programming of this project. The entire codebase, including logic, UI design, and database structures, was written manually by hand.