Skip to content

Naresh-x86/Stable-Polling-V2

Repository files navigation

Stable Polling V2

A modular, multi-window desktop application developed using Python, tkinter, and the ttk themed 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 the mysql-connector-python API.

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!


Database Connection and Error Handling

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
Loading
  • JSON Configuration Parsing
    On initialization, scripts parse config.json to extract connection parameters (host, user, password, database).

  • Dynamic Enumeration
    Upon a successful socket connection, the system executes SHOW DATABASES. The resulting tuple list is parsed and injected directly into the values argument of a ttk.Combobox, allowing the user to select the target schema dynamically at runtime.


Application Modules

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).

UI Initialization and Font Injection

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.


Setup & Run Instructions

Caution

Ensure a MySQL Server instance is running locally or remotely and is reachable by the host machine.

  1. Dependency Installation Initialize a virtual environment and install the required packages:

    pip install mysql-connector-python Pillow
  2. Configuration Copy (example) config.json to config.json and update the connection parameters to match your MySQL environment:

    {
        "host": "localhost",
        "user": "root",
        "password": "yourpassword",
        "database": "polling_db"
    }
  3. 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.

About

An election application developed using Python. Graphical front-end logic split into discrete execution scripts which communicate with a remote or local MySQL server cluster via queries provided by the mysql-connector-python API.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages