Modules.SetViewer.BaseGUI package¶
Submodules¶
Modules.SetViewer.BaseGUI.BaseGUI module¶
-
class
Modules.SetViewer.BaseGUI.BaseGUI.
BaseGUI
(**kwargs)¶ Bases:
abc.ABC
Initialize the base GUI for the set simulator.
- Parameters
sets (dict[str, ComplexSets]) – Mapping of set names to Complex Set objects.
title (str) – Title of the window.
colormap (str) – Default colormap to apply to the GUI figure.
iterations (int) – Max number of iterations to simulate.
dimensions (tuple) (int, int) – used to initialize the respective (width, height) of root widget.
max_interval_delay (int) – Max delay between frame animation.
julia_constant (complex) – (real, imag) specific constant to use for simulating the Julia set.
coord_range (coordinaterange) – the default coordinate range initialized in the GUI.
-
GITHUB_URL
¶ GitHub URI.
- Type
str
-
GITHUB_PNG
¶ GitHub logo/icon path.
- Type
str
-
DEFAULT_PNG
¶ Default image path to use for figure before set generation.
- Type
str
-
SIMULATOR_ICON
¶ Icon path for GUI.
- Type
str
-
SAVE_DIRECTORY
¶ Directory path where images will be saved.
- Type
str
-
MIN_WIDTH
¶ Minimum width of the GUI in pixels.
- Type
int
-
MIN_HEIGHT
¶ Minimum height of the GUI in pixels.
- Type
int
-
SIDEPANEL_WIDTH
¶ Width of the GUI Sidepanel.
- Type
int
-
width
¶ Width of the GUI.
- Type
int
-
height
¶ Height of the GUI.
- Type
int
-
figure
¶ Figure to display the generated sets.
- Type
matplotlib.pyplot.figure
-
canvas
¶ Canvas to connect matplotlib figure and tkinter.
- Type
matplotlib.backends.backend_tkagg.figurecanvastkagg
-
root
¶ Top-level widget for GUI
- Type
-
sidepanel
¶ Main sidepanel container for most of the GUI controls.
- Type
- Raises
MinimumWidthExceeded – Minimum width of the GUI does not match the static minimum width.
MinimumHeightExceeded – Minimum height of the GUI does not match the static minimum height.
ColorMapNotIncluded – Color map is not included in the color maps provided by Matplotlib.
FileNotFoundError – Static images/files were not found in the img/ filepath.
-
DEFAULT_PNG
= 'img/nullset.png'¶
-
GITHUB_PNG
= 'img/github.png'¶
-
GITHUB_URL
= 'https://github.com/RobLaughlin/complex-set-simulator'¶
-
MIN_HEIGHT
= 650¶
-
MIN_WIDTH
= 650¶
-
SAVE_DIRECTORY
= 'images'¶
-
SIDEPANEL_WIDTH
= 250¶
-
SIMULATOR_ICON
= 'img/mset.ico'¶
-
abstract classmethod
animation_checkbox_clicked
(widget: tkinter.Widget)¶ Event handler for animation checkbox onclick. Overridden by implementation.
- Parameters
widget (tkinter.widget) – Widget container of what component triggered the event.
-
abstract classmethod
canvas_onclick
(widget: tkinter.Widget, event)¶ Event handler for the canvas onclick. Overridden by implementation.
- Parameters
widget (tkinter.widget) – Widget container of what component triggered the event.
event (matplotlib.backend_bases.mouseevent) – Event data regarding where on the canvas was clicked.
-
abstract classmethod
color_map_changed
(widget: tkinter.Widget)¶ Event handler for selected colormap change. Overridden by implementation.
- Parameters
widget (tkinter.widget) – Widget container of what component triggered the event.
-
abstract classmethod
continue_btn_clicked
(widget: tkinter.Button)¶ Event handler for continue button onclick. Overridden by implementation.
- Parameters
widget (tkinter.button) – The button that triggered the onclick event.
-
abstract classmethod
generate_btn_clicked
(widget: tkinter.Button)¶ Event handler for the generation button onclick. Overridden by implementation.
- Parameters
widget (tkinter.button) – The generation button.
-
abstract classmethod
imag_part_changed
(widget: tkinter.Widget)¶ Event handler for the real part widget change. Overridden by implementation.
- Parameters
widget (tkinter.widget) – Widget container of what component triggered the event.
-
abstract classmethod
pause_btn_clicked
(widget: tkinter.Widget)¶ Event handler for pause button onclick. Overridden by implementation.
- Parameters
widget (tkinter.widget) – Widget container of what component triggered the event.
-
range_entry_handler
(key: str, entry: str) → bool¶ Validation function for each keystroke of a XY range entry.
- Parameters
key (str) – What specific key was entered into the XY field.
entry (str) – The full entry value of the XY field.
- Returns
True if validation succeeds, False otherwise.
- Return type
bool
-
abstract classmethod
real_part_changed
(widget: tkinter.Widget)¶ Event handler for the real part widget change. Overridden by implementation.
- Parameters
widget (tkinter.widget) – Widget container of what component triggered the event.
-
save_btn_clicked
(widget: tkinter.Button)¶ Event handler for save button click.
- Parameters
widget (tkinter.button) – The save button.
-
set_list_changed
(widget: tkinter.Widget)¶ Event handler for when a different set is selected from the set list.
- Parameters
widget (tkinter.widget) – The set list container widget.
-
exception
Modules.SetViewer.BaseGUI.BaseGUI.
ColorMapNotIncluded
¶ Bases:
Exception
Color map is not included in the color maps provided by Matplotlib.
-
exception
Modules.SetViewer.BaseGUI.BaseGUI.
MinimumHeightExceeded
¶ Bases:
Exception
Minimum height of the GUI does not match the static minimum height.
-
exception
Modules.SetViewer.BaseGUI.BaseGUI.
MinimumWidthExceeded
¶ Bases:
Exception
Minimum width of the GUI does not match the static minimum width.
Modules.SetViewer.BaseGUI.CanvasContainer module¶
-
class
Modules.SetViewer.BaseGUI.CanvasContainer.
Canvas
(master: tkinter.Widget, handler: Callable, size: tuple, fpath: str, dpi=100)¶ Bases:
matplotlib.backends.backend_tkagg.FigureCanvasTkAgg
Main canvas for viewing the complex set generation/image.
- Parameters
master (tkinter.widget) – Parent container of the canvas.
handler (function(widget, event)) – The event handler for the canvas click event.
size (tuple) (int, int) – Width and height of the canvas, respectively.
fpath (str) – File path of the default image to load onto the canvas.
dpi (int, optional) – DPI of the figure, default is 100.
-
property
figure
¶ Figure of the canvas.
- Type
matplotlib.pyplot.figure
-
property
height
¶ Height of the canvas.
- Type
int
-
load_default_figure
(fpath: str)¶ Load the default image into figure when the GUI loads.
- Parameters
fpath (str) – File path of the default image to load onto the canvas.
- Raises
FileNotFoundError – If the default image to load is not found.
-
update
(img: <module 'PIL.Image' from 'c:\\python38\\lib\\site-packages\\PIL\\Image.py'>, cmap='gray', origin='lower', redraw=False)¶ Update the canvas.
- Parameters
img (pil.image) – Image to update the canvas with.
cmap (str, optional) – Colormap to apply to the figure.
origin (str, optional) – Origin of figure.
redraw (bool) – Redraw the canvas.
-
property
width
¶ Width of the canvas.
- Type
int
Modules.SetViewer.BaseGUI.JuliaConstantWidget module¶
-
class
Modules.SetViewer.BaseGUI.JuliaConstantWidget.
JuliaComplexPart
(master: tkinter.Widget, const_range: tuple, handler: Callable, text: str, grid_index: tuple, default_value=0)¶ Bases:
Modules.SetViewer.BaseGUI.LabeledWidget.LabeledWidget
The real or imaginary part widgets for the Julia constant widget.
- Parameters
master (tkinter.widget) – Container of the real/imaginary part widgets.
const_range (tuple) (float, float) – (Minimum, Maximum) for the part range, respecitvely.
handler (function(JuliaComplexPart)) – Event handler for when the part widget is changed.
grid_index (tuple) (int, int) – Location (Row, Col) on the tkinter grid system.
default_value (int) – The default value of the part widget.
-
class
Modules.SetViewer.BaseGUI.JuliaConstantWidget.
JuliaConstantWidget
(master: tkinter.Widget, widget_params: Dict[str, object], minwidth: int)¶ Bases:
tkinter.LabelFrame
The container widget for the complex constant used in generating the Julia set.
- Parameters
master (tkinter.widget) – Container of the Julia set constant widget.
widget_params (dict[str, object]) – Widget-specific configuration.
minwidth (int) – The minimum width if the Julia constant widget.
grid_index (tuple) (int, int) – The respective (row, column) position on the tkinter grid.
real_handler (function(JuliaComplexPart)) (Widget Arg) – Event handler for when the real part widget is changed.
real_range (tuple) (float, float) (Widget Arg) – Respective minimum and maximum for the real range.
imag_handler (function(JuliaComplexPart)) (Widget Arg) – Event handler for when the imaginary part widget is changed.
imag_range (tuple) (float, float) (Widget Arg) – Respective minimum and maximum for the imaginary range.
default_value (complex) (Widget Arg) – Complex number to use as the default selected constant for the Julia set widget.
-
hide
()¶ Hide the widget.
-
property
imag
¶ The value of the imaginary_part componen.
- Type
float
-
property
real
¶ The value of the real_part component.
- Type
float
-
show
()¶ Show the widget.
Modules.SetViewer.BaseGUI.LabeledWidget module¶
-
class
Modules.SetViewer.BaseGUI.LabeledWidget.
LabeledWidget
(master: tkinter.Widget, widget: tuple, text: str, grid_index: tuple)¶ Bases:
tkinter.Frame
Wrapper frame for widgets that have a label and widget side by side.
- Parameters
master (tkinter.widget) – The LabelWidget’s container.
widget (tuple) (widget, options) – The tuple consisting of the widget (tkinter.XX) and its specified options (dict).
text (str) – Text of the label.
grid_index (tuple) (int, int) – Location (Row, Col) on the tkinter grid system.
-
property
label
¶ The label of the component.
- Type
tk.label
-
property
text
¶ The label text of the component.
- Type
str
-
property
val
¶ The current value of the component widget.
- Type
object
-
property
widget
¶ The widget of the component.
- Type
tkinter.widget
Modules.SetViewer.BaseGUI.Picture module¶
-
class
Modules.SetViewer.BaseGUI.Picture.
AnimationCheckbox
(master: tkinter.Widget, handler: Callable, grid_index: tuple, checked_default=True)¶ Bases:
tkinter.Checkbutton
Animation checkbox subcomponent.
- Parameters
master (tkinter.widget) – Animation checkbox container widget.
handler (function(widget)) – Event handler for checkbox click.
grid_index (tuple) (int, int) – (Row, Col) position on the tkinter grid.
checked_default (bool) – Whether to initially check the animation checkbox.
-
property
val
¶ Value of animation checkbox.
- Type
tkinter.booleanvar
-
class
Modules.SetViewer.BaseGUI.Picture.
ColormapWidget
(master: tkinter.Widget, handler: Callable, grid_index: tuple, colormaps: list, default_value: str)¶ Bases:
Modules.SetViewer.BaseGUI.LabeledWidget.LabeledWidget
Colormap subcomponent.
- Parameters
master (tkinter.widget) – Colormap container widget.
handler (function(widget)) – Event handler for widget selection
grid_index (tuple) (int, int) – (Row, Col) position on the tkinter grid.
colormaps (list) – List of available Matplotlib colormaps.
default_value (str) – Default colormap.
-
class
Modules.SetViewer.BaseGUI.Picture.
PictureWidget
(master: tkinter.Widget, widget_params: Dict[str, object], minwidth: int)¶ Bases:
tkinter.LabelFrame
Picture (GUI) frame.
- Parameters
master (tkinter.widget) – Container widget for picture frame.
widget_params (dict[str, object]) – widget-specific options.
minwidth (int) – Minimum width of picture frame.
colormaps (list) (Widget Arg) – List of available Matplotlib color maps.
default_colormap (str) (Widget Arg) – Default color map to select on load.
colormap_changed (function(widget)) (Widget Arg) – Event handler for colormap changing selection.
anim_btn_clicked (function(widget)) (Widget Arg) – Event handler for clicking the animation button.
save_btn_clicked (function(widget)) (Widget Arg) – Event handler for clicking the save button.
-
property
animation
¶ Animation checkbox.
- Type
picture.animationcheckbox
-
property
colormaps
¶ Available Matplotlib color maps.
- Type
picture.colormapwidget
Save image button.
- Type
tkinter.button
Modules.SetViewer.BaseGUI.Root module¶
-
class
Modules.SetViewer.BaseGUI.Root.
RootWidget
(title: str, dimensions: tuple, minwidth: int)¶ Bases:
tkinter.Tk
Root widget for complex set viewer.
- Parameters
title (str) – Title of the root window.
dimensions (tuple) (int, int) – The (width, height) of the root widget.
minwidth (int) – The minimum width of the root widget.
-
property
dimensions
¶ (width, height) Size dimensions of root widget.
- Type
tuple
-
property
icon
¶ Icon filepath of root widget.
- Type
str
-
property
title
¶ Title of the root widget.
- Type
str
Modules.SetViewer.BaseGUI.Sidepanel module¶
-
class
Modules.SetViewer.BaseGUI.Sidepanel.
SidepanelWidget
(master: tkinter.Widget, grid_index: tuple)¶ Bases:
tkinter.Frame
Sidepanel container for complex set viewer.
- Parameters
master (widget) – Container of Sidepanel widget.
grid_index (tuple) – (row, column) Position on grid.
-
add_component
(key: str, component: tkinter.Widget)¶ Add subcomponent to the sidepanel.
- Parameters
component (widget) – The component to add to the sidepanel
key (str) – Identifier of specified subcomponent
-
property
components
¶ Dict of subcomponents in sidepanel.
- Type
Dict[str, widget]
-
property
row
¶ Row of subcomponent in Sidepanel.
- Type
int
Modules.SetViewer.BaseGUI.Simulation module¶
-
class
Modules.SetViewer.BaseGUI.Simulation.
AnimationDelayWidget
(master: tkinter.Widget, max_animation_delay: int, grid_index: tuple, default_value=1)¶ Bases:
Modules.SetViewer.BaseGUI.LabeledWidget.LabeledWidget
Animation delay subcomponent.
- Parameters
master (tkinter.widget) – The animation delay component’s container.
max_animation_delay (int) – Maximum delay (MS) between franes.
grid_index (tuple) – (int, int) Location on the tkinter grid system.
default_value (int, optional) – Default value on the delay scale.
-
class
Modules.SetViewer.BaseGUI.Simulation.
GenerationControlWidget
(master: tkinter.Widget, generate_handler: Callable, pause_handler: Callable, continue_handler: Callable, grid_index: tuple)¶ Bases:
tkinter.Frame
Generation control frame subcomponent.
- Parameters
master (tkinter.widget) – The generation control component’s container.
generate_handler (function(button)) – Event handler for generate button click.
pause_handler (function(button)) – Event handler for pause button click.
grid_index (tuple) – (int, int) Location on the tkinter grid system.
-
property
generate
¶ Generate button
- Type
tkinter.button
-
property
pause
¶ Pause button
- Type
tkinter.button
-
toggle_pause
(continue_: bool)¶ Toggles the pause and continue states for the pause button.
- Parameters
continue (bool) – Whether to set the pause button to the continue state or the pause state.
-
class
Modules.SetViewer.BaseGUI.Simulation.
IterationWidget
(master: tkinter.Widget, max_iterations: int, grid_index: tuple, default_value=1)¶ Bases:
Modules.SetViewer.BaseGUI.LabeledWidget.LabeledWidget
Iteration subcomponent.
- Parameters
master (tkinter.widget) – The iteration component’s container.
max_iterations (int) – Maximum iterations for complex set calculations.
grid_index (tuple) – (int, int) Location on the tkinter grid system.
default_value (int, optional) – Default value on the iteration scale.
-
property
max_iterations
¶ Maximum iterations for complex set calculations.
- Type
int
-
class
Modules.SetViewer.BaseGUI.Simulation.
SetListWidget
(master: tkinter.Widget, handler: Callable, setlist: list, grid_index: tuple, default_value=0)¶ Bases:
Modules.SetViewer.BaseGUI.LabeledWidget.LabeledWidget
Set list subcomponent.
- Parameters
master (tkinter.widget) – The set list component’s container.
handler (function(widget)) – Event handler for selecting a different set.
grid_index (tuple) – (int, int) Location on the tkinter grid system.
default_value (int, optional) – Default set
-
class
Modules.SetViewer.BaseGUI.Simulation.
SimulationWidget
(master: tkinter.Widget, widget_params: Dict[str, object], minwidth: int)¶ Bases:
tkinter.LabelFrame
Simulation frame subcomponent.
- Parameters
master (tkinter.widget) – The simulation frame’s container.
widget_params (dict[str, object]) – widget-specific options
minwidth (int) – Minimum width of simulation frame.
max_iterations (int) (Widget Arg) – Maximum iterations for complex set calculations.
max_delay (int) (Widget Arg) – Maximum animation delay between rendering frames.
setlist (simulation.setlistwidget) (Widget Arg) – Complex set widget container.
setlist_changed (function(widget)) (Widget Arg) – Event handler for changing the set list.
generate_btn_clicked (function(button)) (Widget Arg) – Event handler for clicking the generate button.
pause_btn_clicked (function(button)) (Widget Arg) – Event handler for clicking the pause button.
-
property
delay
¶ Animation delay subcomponent.
- Type
simulation.animationdelaywidget
-
property
generation
¶ Generation control container subcomponent.
- Type
simulation.generationcontrolwidget
-
property
iterations
¶ Iteration subcomponent.
- Type
simulation.iterationwidget
-
property
progress_bar
¶ Set generation progress bar.
- Type
tkinter.ttk.progressbar
-
property
setlist
¶ Animation delay subcomponent.
- Type
simulation.animationdelaywidget
Modules.SetViewer.BaseGUI.XYFrame module¶
-
class
Modules.SetViewer.BaseGUI.XYFrame.
RangeFrame
(master: tkinter.Widget, validate: Callable, grid_index: tuple, coord_range: tuple, text: str)¶ Bases:
tkinter.Frame
Coordinate Range container between a minimum and maximum value.
- Parameters
master (tkinter.widget) – The container of the range frame.
validate (function(key, entry)) – Validation event when a key is entered.
grid_index (tuple) – (int, int) Row and column position on the tkinter grid.
text (str) – Text of each minumum and maximum label.
-
property
max
¶ Maximum value in range.
- Type
“labeledwidget
-
property
min
¶ Minimum value in range.
- Type
labeledwidget
-
class
Modules.SetViewer.BaseGUI.XYFrame.
XYFrame
(master: tkinter.Widget, widget_params: Dict[str, object], minwidth: int)¶ Bases:
tkinter.LabelFrame
XY Coordinate range frame.
- Parameters
master (tkinter.widget) – The container of the XY frame.
widget_params (dict[str, object]) – Widget-specific arguments.
minwidth (int) – Minimum width of the XY frame.
coord_range (CoordinateRange) (Widget Arg) – Full XY coordinate range.
validate (function) (Widget Arg) – Keystroke validation function on each x&y component.
-
property
coord_range
¶ Returns a XY CoordinateRange if both the X and Y ranges are valid.
- Returns
The validated coordinate object of the XY range. coordinaterange.invalidcoordinatebounds: If the validation of range(s) fails. ValueError: If the characters typed in the XY range fields are not valid floats.
- Return type
coordinaterange
-
update_all
(coord_range: Modules.ComplexSets.CoordinateRange.CoordinateRange)¶
-
property
x_range
¶ X min/max coordinate range subcomponent.
-
property
y_range
¶ Y min/max coordinate range subcomponent.