From 6bb904e94369a14239b9ce51516497065272e12a Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Sat, 12 Jun 2021 18:39:22 -0400 Subject: added Sweeper test --- funcGenerator.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/funcGenerator.py b/funcGenerator.py index d9abf06..b34dcce 100644 --- a/funcGenerator.py +++ b/funcGenerator.py @@ -157,3 +157,24 @@ class Sweeper: def getRelPos(self): return self.relPos +def testSweeper(sweeper): + print( sweeper.getPos() ) + if sweeper.getPos() == sweeper.Npoints: + print("Done") + sweeper.cmdStop() + sweeper.widget.destroy() + sweeper.widget.quit() + +if __name__ == '__main__': + from tkinter import Tk + root=Tk() + root.geometry("800x600") + root.withdraw(); # do not show window + + Np = 10 + SweepTime = Np + print(f'Test sweeper: you should see a sequence of {Np} numbers updating about every {SweepTime/Np} seconds') + sweeper = Sweeper(root, Npoints=Np, SweepTime=SweepTime, onTicCallbacks=[testSweeper]) + sweeper.cmdStart() + + root.mainloop() -- cgit v1.2.3