runner.py 679 B

123456789101112131415161718192021222324252627282930
  1. '''
  2. Created on 27-jul.-2014
  3. @author: Simon
  4. '''
  5. import tkinter as tk
  6. import target as target
  7. from sccd.runtime.libs.ui_v2 import UI
  8. from sccd.runtime.tkinter_eventloop import TkEventLoop
  9. class OutputListener:
  10. def __init__(self, ui):
  11. self.ui = ui
  12. def add(self, event):
  13. if event.port == "ui":
  14. method = getattr(self.ui, event.name)
  15. method(*event.parameters)
  16. if __name__ == '__main__':
  17. tkroot = tk.Tk()
  18. tkroot.withdraw()
  19. controller = target.Controller(TkEventLoop(tkroot))
  20. ui = UI(tkroot, controller)
  21. controller.addMyOwnOutputListener(OutputListener(ui))
  22. controller.setVerbose("./examples/BouncingBalls/Python/trace.txt")
  23. controller.start()
  24. tkroot.mainloop()