ctkWidgetsTest.py 620 B

123456789101112131415161718192021222324
  1. from ctk import *
  2. from qt import QTimer
  3. # Test display of a CTK widget
  4. w = ctkMatrixWidget()
  5. w.show()
  6. # Test command execution using Python manager
  7. pythonManager = _ctkPythonManagerInstance
  8. pythonManager.executeString("variableInPythonConsole=523")
  9. try:
  10. print("variableInPythonConsole was successfully set to {0}".format(variableInPythonConsole))
  11. except:
  12. print("PythonManager.executeString failed")
  13. qt.QApplication.exit(1)
  14. if not _ctkPythonConsoleInstance.isInteractive:
  15. #QTimer().singleShot(0, app(), SLOT('quit()'))
  16. t = QTimer()
  17. t.setInterval(250)
  18. t.connect('timeout()', app(), 'quit()')
  19. t.start()