GUI

All the scripts and modules tasked to create the GUI for Gaussian-2-Blender. The GUI was built using Python’s tkinter library.

Main GUI Script

Actions Region Module

class ActionsRegion.ActionsRegion(parent, on_reset, on_convert, current_os, g2b_path)[source]

Bases: object

Blender Path Module

Bond Conventions Module

class BondConventions.BondConventions(parent)[source]

Bases: object

region of the window that specifies meaning of some coordination values

Console Region Module

class ConsoleRegion.ConsoleRegion(parent)[source]

Bases: object

GUI region that allows user to observe the print statements and the errors

clear_content()[source]

Coordinates Module

class Coordinates.Coordinates[source]

Bases: object

check_animationframes(file_paths)[source]

Checks whether all animation frames (molecular structure files) have the same number and identity of elements.

  1. Gets the first element of every tuple in the first coordinate set.

  2. Creates a list ‘coord’ of coordinates for every file_path in the list.

  3. Compares the values in ref_elements (from the first file) with those in all_elements.

  4. Returns True if all elements match, otherwise returns False.

Parameters:

file_paths (list of str) – List of file paths to the molecular structure files.

Returns:

True if all files have the same number and identity of elements, False otherwise.

Return type:

bool

check_newline_characters(file_path)[source]

Checks the newline character type used in a file.

Parameters:

file_path (str) – The path to the file to check.

Returns:

The newline type used in the file: ‘windows’, ‘unix’, or ‘mac’.

Return type:

str or None

combine_animation_frames(file_paths)[source]

Combines Cartesian coordinates from multiple molecular structure files into a single list of tuples.

Parameters:

file_paths (list of str) – A list of strings containing the paths to the files representing different frames.

Returns:

A list of tuples, where each tuple contains: - atom_id (str): The identifier of the atom (e.g., “C01” for carbon). - coordinates (float, float, …, float): The Cartesian coordinates for the atom across all frames.

Return type:

list of tuple

extract_cartesian_coordinates(file_path)[source]

Extracts Cartesian coordinates from a molecular structure file.

Parameters:

file_path (str) – The path to the file containing the molecular structure.

Returns:

A list of tuples, where each tuple contains: - atom_id (str): The atomic symbol with an element index (e.g., “C01” for carbon). - x (float): The x-coordinate of the atom. - y (float): The y-coordinate of the atom. - z (float): The z-coordinate of the atom.

Return type:

list of tuple

get_coordinates_line_numbers(file_lines)[source]

Finds the line numbers where the Cartesian coordinates are located in the file.

Parameters:
  • file_lines (list of str) – List of lines read from the molecular structure file.

  • extension – File extension to check (default is “.com”).

Returns:

A tuple (start_line, end_line), where start_line is the first line containing coordinates and end_line is the line after the last coordinate.

Return type:

tuple

Create Tooltip Module

class CreateTooltip.CreateTooltip(widget, text='widget info')[source]

Bases: object

A class to create tooltips for a given widget in Tkinter.

This class binds event handlers to the widget to show and hide tooltips when the mouse hovers over or leaves the widget.

enter(event=None)[source]

Handles the mouse entering the widget. Schedules the tooltip to be shown.

Parameters:

event – The event triggered by the mouse entering the widget.

hidetip()[source]

Hides the currently displayed tooltip. Destroys the Toplevel window containing the tooltip.

leave(event=None)[source]

Handles the mouse leaving the widget. Unschedules and hides the tooltip.

Parameters:

event – The event triggered by the mouse leaving the widget.

schedule()[source]

Schedules the tooltip to be shown after a delay.

Cancels any previously scheduled tooltip and sets a new timer to show the tooltip.

showtip(event=None)[source]

Displays the tooltip near the widget. Creates a Toplevel window with the tooltip text and positions it near the widget.

Parameters:

event – The event triggered by the mouse entering the widget.

unschedule()[source]

Cancels any scheduled tooltip display.

If there is an active scheduled tooltip, it will be cancelled.

Highlighter Region Module

class HighlighterRegion.HighlighterRegion(parent)[source]

Bases: object

addThreshold()[source]

Create a new row with read-only dropdowns for Atom 1, Atom 2, Bond order, and an entry for the numeric threshold.

add_widgets()[source]

Adds widgets (checkboxes, labels, and entry fields) for atom and bond highlighting.

check_for_atom_syntax(entry: str) bool[source]

Checks if the atom entry follows the correct syntax: ElementSymbol + two-digit number.

Parameters:

entry (str) – The atom entry to validate (e.g., “C01”, “H02”).

Returns:

True if the entry is valid, False otherwise.

Return type:

bool

check_for_bond_syntax(entry: str) bool[source]

Checks if the bond entry follows the correct syntax (e.g., “C01-C02”; “C03=C04”).

Parameters:

entry (str) – The bond entry to validate.

Returns:

True if the bond entry follows the correct syntax, False otherwise.

Return type:

bool

clear_variables()[source]

Clears the atom and bond highlighting variables (reset to defaults).

get_custom_thresholds()[source]
Returns a list of dicts:
{

“atom_pair”: (“Atom1Symbol”, “Atom2Symbol”), # canonicalized (sorted) “bond_order”: int, # 1, 2, or 3 “threshold”: float # Å

}

Skips incomplete/invalid rows.

initialize_variables()[source]

Initializes the variables for atom and bond highlighting.

on_enable_editing(event, tk_textbox, tk_checkbox_variable)[source]

Enables editing for the clicked entry box if the associated checkbox is checked.

Parameters:
  • event (tk.Event) – The event that triggered this function.

  • tk_textbox (tk.Entry) – The text entry widget to enable or disable.

  • tk_checkbox_variable (tk.BooleanVar) – The associated checkbox’s variable that determines the state.

on_validate_atom_list(event=None)[source]

Handles validation when the atom entry loses focus or the Enter key is pressed.

Parameters:

event (tk.Event, optional) – The event that triggered the validation. Default is None.

Returns:

Returns “break” if Enter was pressed and input is invalid, otherwise None.

Return type:

str | None

on_validate_bond_entry(event=None, var=None, entry_widget=None)[source]

Handler for validating bond entries.

Parameters:
  • event (tk.Event, optional) – The event that triggered the validation.

  • var (tk.StringVar) – The variable linked to the entry widget.

  • entry_widget (tk.Entry) – The entry widget to validate.

Returns:

Returns “break” if Enter was pressed and input is invalid, otherwise None.

Return type:

str | None

position_widgets()[source]

Positions the widgets inside the frame using grid layout.

removeThreshold()[source]

Remove the most recently added custom threshold row (if any).

reset_highlighter_options()[source]

Resets the highlighter options (e.g., disables widgets and clears input lists).

setup_frame(parent)[source]

Sets up the frame for the highlighter region.

Parameters:

parent (tk.Widget) – The parent widget to attach the frame to.

toggleAtomHighlighter()[source]

Toggles the state of atom highlighting. Enables or disables the atom list entry. If the checkbox is checked, the atom list entry is enabled. If unchecked, it is disabled and cleared.

toggleBondForcer()[source]

Toggles the possibility of forcing two atoms to be bonded in a specific way. Only works when there is only one input file. If the checkbox is checked, the bond force list entry is enabled. If unchecked, it is disabled and cleared.

toggleBondHighlighter()[source]

Toggles the state of bond highlighting. Enables or disables the bond list entry. If the checkbox is checked, the bond list entry is enabled. If unchecked, it is disabled and cleared.

toggleCustomThreshold()[source]

Toggles the ability to customize the threshold between two atoms and make it a type of bond.

validate_atom_list(entry: str) bool[source]

Validates a comma-separated list of atom entries.

Parameters:

entry (str) – A comma-separated string of atom entries to validate (e.g., “C01, H02”).

Returns:

True if all entries are valid, False if any entry is invalid.

Return type:

bool

validate_bond_list(entry: str) bool[source]

Validates a semicolon-separated list of bond entries.

Parameters:

entry (str) – A semicolon-separated string of bond entries to validate (e.g., “C01-C02; C03=C04”).

Returns:

True if all bond entries are valid, False if any entry is invalid.

Return type:

bool

Information Module

Input Region Module

Ion Conventions Module

class IonConventions.IonConventions(parent)[source]

Bases: object

region of the window that specifies meaning of some coordination values

Ionic Module

class Ionic.Ionic(charge=0, coordination='N/A', radius=0.0)[source]

Bases: object

Ionic radius class. Stores: charge, spin, coordination

set_radius(value: float)[source]

Ion Region Module

class IonRegion.IonRegion(parent)[source]

Bases: object

Section of the app that receives information about possible ions present

addIon()[source]

Add a new ion entry to the ion list.

canvasConfig(event)[source]

Configure the canvas scroll region based on the frame size.

Parameters:

event (tk.Event) – The event triggered by frame resizing.

clear_radii_variables()[source]

Reset all variables and remove existing ions from the section.

create_widgets(parent)[source]

Create all widgets and frames for the ion information section.

Parameters:

parent (tk.Widget) – The parent widget that will contain this section.

disable_ionic_buttons()[source]

Disable all ionic input buttons and remove existing ion entries.

initialize_variables()[source]

Initialize all variables used in the ion information section.

ionic_radii_activator()[source]

Enable or disable ionic input options based on the checkbox state.

removeAllIons()[source]

Remove all ion entries from the list.

removeIon()[source]

Remove the last added ion from the list, if available.

setup_layout()[source]

Arrange the widgets and frames in the grid layout.

unit_cell_activator()[source]

Output Region Module

class OutputRegion.OutputRegion(parent, initial_dir)[source]

Bases: object

Section of the app that selects the output path for the converted file(s)

dropdown_callout(event)[source]
restrict_output_types_for_animation(is_animation)[source]

Updates the list of selectable output file types based on whether animation is enabled.

Parameters:

is_animation (bool) – Indicates whether the animation mode is active.

Behavior:
  • Clears the current dropdown menu options.

  • Populates the menu with the appropriate list of file types.

  • Resets the selected output type if the current selection is no longer valid.

setOutputPath()[source]

Selected Ion Module

class SelectedIon.SelectedIon(parent, row_number, column_number)[source]

Bases: object

Ion data widget that contains the information for one ion. This widget allows the user to select an element, specify its charge, and coordination number based on predefined ionic radii data.

change_charge(*args)[source]

Update the charge and coordination options when a new element is selected.

delete()[source]

Remove this ion selection widget from the UI.

select_pair(*args)[source]

Text Redirector Module

class TextRedirector.TextRedirector(widget, tag='stdout')[source]

Bases: object

To be able to see print statements in the GUI

write(str)[source]

Tutorial Module

Utility Module

Walkthrough Region Module

class WalkthroughRegion.WalkthroughRegion(parent)[source]

Bases: object

modify_guide_text(new_text)[source]
revert_text_to_default()[source]