Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pyuisupport.py 843B

1 year ago
123456789101112131415161718192021222324252627282930313233343536373839
  1. # Copyright (c) Twisted Matrix Laboratories.
  2. # See LICENSE for details.
  3. """
  4. This module integrates PyUI with twisted.internet's mainloop.
  5. Maintainer: Jp Calderone
  6. See doc/examples/pyuidemo.py for example usage.
  7. """
  8. # System imports
  9. import pyui # type: ignore[import]
  10. def _guiUpdate(reactor, delay):
  11. pyui.draw()
  12. if pyui.update() == 0:
  13. pyui.quit()
  14. reactor.stop()
  15. else:
  16. reactor.callLater(delay, _guiUpdate, reactor, delay)
  17. def install(ms=10, reactor=None, args=(), kw={}):
  18. """
  19. Schedule PyUI's display to be updated approximately every C{ms}
  20. milliseconds, and initialize PyUI with the specified arguments.
  21. """
  22. d = pyui.init(*args, **kw)
  23. if reactor is None:
  24. from twisted.internet import reactor
  25. _guiUpdate(reactor, ms / 1000.0)
  26. return d
  27. __all__ = ["install"]