Electron Config Generator Python App
Electron Config Generator
Author: Arvin Javaheripur
Created: November 9th, 2023
License: GNU Lesser General Public License v3.0
Overview
The Electron Config Generator is a lightweight GUI-based Python application that calculates the full electron configuration of chemical elements and visualizes their Bohr models. This tool is useful for chemistry students and teachers who want to quickly determine electron configurations of elements and their atomic structures.
Features
- Calculates electron configurations for elements up to atomic number 118.
- Handles some orbital filling exceptions.
- Displays the Bohr model of atoms.
- Interactive GUI using PySimpleGUI.
Screenshot

Output for atomic number 26 (Fe)
How it Works
- Enter the atomic number of the element.
- Click Show Electron Configuration.
- The application calculates the electron configuration using the standard orbital filling rules.
- A Bohr model is drawn with a big red circle representing the nucleus and electrons represented as small blue circles.
Note
This code may not always output the correct electron configuration due to orbital fulling exceptions.
Code Explanation
Below I go though the Python code step by step, with comments explaining each part.
1. Electron Configuration Calculation
1 | def electron_configuration(electron_num): |
2. Superscript Conversion and Input Validation
1 | def convert_superscript(number): |
- Used for superscript notation like
1s². Just for aesthetic purposes.
1 | def integer_test(string): |
- Used to validate input from the text box to avoid errors and safely reject bad input (for example, “abc” won’t be accepted).
3. Drawing the Bohr Model
1 | def draw_bohr_model(): |
- Uses PySimpleGUI Graph to render Bohr model.
- Nucleus = red circle.
- Electron shells = unfilled circles.
- Electrons = blue circles evenly spaced using
cos/sin.
Installation
Want to try it out? Run these commands:
1 | git clone https://github.com/ajavaheripur/Electron-Config-Generator.git |
Requirements:
- Python 3.8+
- PySimpleGUI
Check out the project on GitHub for updates.
