5. Visualization - Siromanec/logic_discr GitHub Wiki

Visuals

This module contains all the textures of our app and the main module with GUI interface

Interface

Screenshot 2022-06-06 010810

Classes and functions

Class Line

Used to represent the conductors and connect pins

line = Line(color="black", 
            width = 3,
            canvas: Canvas=root_canvas, 
            connected_pins=(Pin, Pin))

Methods

set_connected_pins - sets tuple of pins that are connected by this line

get_connected_pins - returns a tuple of pins that are connected by this line

clear_last_pins - clears a list with the last pair of pins to connect

valide_click- checks if a user clicked on the free pin

draw_line - connects two dots with a line

Other Functions

  • delete deletes an element from the canvas

  • curr_com_put defines that is time to call (binds left click with) a function that puts element images and creates an appropriate object

  • put puts image of an element on the canvas and creates an appropriate object

  • switch_click switches click's image on right click

  • curr_com_connect responsible for the connect button

  • curr_com_delete responsible for the delete button

  • start starts the main Tk loop

  • main contains the setups of all the object on the app

Libraries used

  • Tkinter as the main GUI toolkit
  • Customtkinter a module by Tom Schimansky and co from here for custom buttons, frames, texts and etc.
  • PIL for processing png images for buttons and for displaying on the canvas