gui package¶
Submodules¶
gui.conf module¶
Provides ConfigFrame, the Tkinter frame that allows modifying the visualiser configuration
-
class
gui.conf.
ConfigFrame
(root, main)[source]¶ Bases:
tkinter.Frame
Frame allowing the configuration of the visualiser
Contains a number of Tkinter controls allowing the modification of attributes in
SimulatorConfig
-
_labelControl
(text, control, ctrlOpts={})[source]¶ Create a label and a widget, which are placed adjacent on the same row.
Parameters: Returns: The created
Widget
control
-
_load
()[source]¶ Load values into the controls from the
SimulatorConfig
-
_matches
= {'CarScale': 'carScale', 'CarSpeed': 'carSpeed', 'ObstacleInterval': 'obstFreq', 'ObstacleSpeed': 'obstSpeed'}¶ SimulatorConfig
attributes as keys, associated private attributes (with a set() method) as attributes. These config values are allfloat
-
_save
()[source]¶ Save values into the
SimulatorConfig
from the controls
-
gui.controls module¶
Provides custom Tkinter controls
-
class
gui.controls.
LabeledScale
(root, font, resolution=2, **kwargs)[source]¶ Bases:
tkinter.Frame
tkinter.ttk.Scale
and atkinter.Spinbox
joined in a frameThe
Scale
in shown to the left of theSpinbox
Parameters: - root – Parent
tkinter.Widget
- font –
Font
to use in theSpinbox
- resolution – (
int
) Number of decimal places to round stored and displayed value to
-
_update
(val=None)[source]¶ Callback method for both the
Spinbox
andScale
so that each can update the other, and the value can be properly formatted
- root – Parent
gui.main module¶
The main window and main page which links to the others
-
class
gui.main.
MainFrame
(root, main)[source]¶ Bases:
tkinter.Frame
Main ‘page’ of the application, linking to the
Simulator
andConfigFrame
usingButton
widgets. These cause theMainWindow
to focus on the desired frameParameters: - root –
Widget
parent - main –
MainWindow
- root –
-
class
gui.main.
MainWindow
(*args, **kwargs)[source]¶ Bases:
tkinter.Tk
The main Tkinter window of the application
Encapsulates
Simulator
andConfigFrame
-
_keyPress
(event)[source]¶ Tkinter key press callback method, sends events to the
Simulator
if it is currently focused
-
gui.panel module¶
Provides the side panel shown alongside the visulaiser
-
class
gui.panel.
SimulatorPanel
(parent, sim, visualiser, **kwargs)[source]¶ Bases:
tkinter.Frame
Side panel of the window, extends tk.Frame. Shows information about the visulisation.
Parameters: - parent – Parent
tkinter.Widget
- sim –
Simulator
instance to control - visualiser –
SimulatorVisualiser
instance to take information from - kwargs – keyword arguments to pass to superclass constructor
-
_call
(func)[source]¶ Return a function that focuses the panel then calls func
Used for button commands
-
tick
()[source]¶ Update displayed information using the
SimulatorVisualiser
- parent – Parent
gui.sim module¶
Provides the main simulator, which includes the Pygame visualiser and a Tkinter panel
-
class
gui.sim.
NameDatasetPopup
(main)[source]¶ Bases:
tkinter.Toplevel
A Tkinter popup that requests a name for a training set.
It will check if the name is in use; if it is, another prompt asks whether it should be overriden or another name should be input.
-
class
gui.sim.
Simulator
(root, main)[source]¶ Bases:
tkinter.Frame
The GUI component of the visualiser Contains the
SimulatorVisualiser
(Pygame canvas) in atkinter.ttk.Frame
. TheSimulatorPanel
is displayed alongside it.-
focus
()[source]¶ If loaded in manual mode, create a
NameDatasetPopup
to choose the training data name.If in AUDRI mode, train the model
-
mode
¶ - The current mode in which the simulator should run in.0 = Manual: Collect training data1 = AUDRI: Train AUDRI and let it control the car2 = Compare: Allow both expert and AUDRI to control two different cars, side by side
Getter: Get the current mode Setter: Set the current mode, also setting the mode of the SimulatorVisualiser
. Prevents setting an invalid modeType: int
-
setDataset
(name)[source]¶ Set the
_datasetName
property from theNameDatasetPopup
, unpause theSimulatorVisualiser
, and return focus to the main windowParameters: name – str
name of dataset to store training data in
-