Display data representing I/O times, 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 x-axis is doty - day of the year.

#!/usr/bin/env python3

import PyTango
import time, sys
import PySpectra
import HasyUtils

MAX = 10000

def main():
    proxy = PyTango.DeviceProxy( "haspp09mono:10000/pm/e6cctrl/1")

    diffTimeMax = 0.
    diffTime = 0.
    PySpectra.cls()
    PySpectra.delete()

    PySpectra.setTitle( "DiffTime: 10x(readPosition, sleep(0.1))")
    PySpectra.setWsViewport( "DINA5")
    dTime = PySpectra.Scan( name = 'diffTime', nPts = (MAX + 1), 
                            autoscaleX = True, doty = True, lineColor = 'red')


    beginTime = time.time()
    count = 0
    print( "Press <space> to terminate loop")
    for j in range( MAX):
        startTime = time.time()
        if HasyUtils.inkey() == 32:
            break
        for i in range(10):
            xtemp = proxy.Position
            time.sleep( 0.1)
        print( "%d/%d %s at %g, diffTime %g/ %g " % 
               (j, MAX, proxy.name(), proxy.position, diffTime, diffTimeMax))
        diffTime = time.time() - startTime
        if diffTime > diffTimeMax:
            diffTimeMax = diffTime
        dTime.setX( count, HasyUtils.getDoty())
        dTime.setY( count, diffTime)
        count += 1
        PySpectra.display()

    print( "Press <space> to quit program")
    while 1:
        PySpectra.processEvents()
        if HasyUtils.inkey() == 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()