PythonForTheLab.View

All the files related to the GUI should be placed within the View package. This is the third leg of the MVC design pattern. If the Model is properly built, the Views are relatively simple PyQt objects. It is important to point out that if there is any logic of the experiment that goes into the view, the code is going to become harder to share, unless it is for the exact same purpose.

Start GUI

Convenience function to wrap the initialization of a window. The Experiment class should be created outside and passed as argument.

>>> experiment = Experiment()
>>> experiment.load_config('filename')
>>> experiment.load_daq()
>>> start_gui(experiment)
PythonForTheLab.View.start_gui.start_gui(experiment)[source]

Starts a GUI for the ScanWindow using the provided experiment. :param Experiment experiment: Experiment object with a loaded config.

Main Window

This is the central code for the user interface of Python for the Lab. The design of the window is specifcied in its own .ui file, generated with Qt Designer.

class PythonForTheLab.View.main_window.MainWindow(experiment=None)[source]

Bases: PyQt5.QtWidgets.QMainWindow

Main Window for the user interface

Parameters:experiment (Experiment) – Experiment model, can be left empty just for testing. Should be instantiated and initialized before passing it.
experiment

The experiment object

Type:Experiment
plot_widget

Widget to hold the plot

Type:pg.PlotWidget
plot

The real plot that can be updated with new data

Type:pg.PlotWidget.plotItem
start_button

The start button

Type:QPushButton
start_scan()[source]
stop_scan()[source]
update_gui()[source]
update_plot()[source]