Very simple, display some data, with PySpectra main widget

The following piece of codes opens a graphical window (7.1.2), the pysp main widget (7.1.2) and displays some data. The PySpectra main widget allows you to tune the attributes (7.1.2), make other changes to the plot, create a hardcopy, etc.

#!/usr/bin/env python3

import time, sys, random
import HasyUtils, PySpectra

def main():

    MAX = 25
    pos = [float(n)/MAX for n in range( MAX)]
    rd = [random.random() for n in range( MAX)]

    PySpectra.Scan( name = 'random', x = pos, y = rd)
    PySpectra.display()

    print( "Press <space> to quit")
    while 1:
        PySpectra.processEvents()
        key = HasyUtils.inkey()
        if key == 32:
            return 
        time.sleep( 0.1)
    
    return

if __name__ == "__main__":
    import PySpectra.pySpectraGuiClass

    app = PySpectra.QApplication(sys.argv)
    gui = PySpectra.pySpectraGuiClass.pySpectraGui( flagExitOnClose = True)
    gui.show()

    main()

Figure 7.2: Very simple, display some data, with pysp main widget
Image examplePysp2

Figure 7.3: Very simple, display some data, pysp main widget
Image examplePysp2a

Figure 7.4: Very simple, display some data, attributes widget
Image examplePysp2b