Advertisement
Krystal_Amaia

Why won't this terminate?

Aug 29th, 2020
1,956
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.10 KB | None | 0 0
  1. #!/usr/bin/python3
  2. from circuits import Component, Event, Debugger
  3. from libs import t1tbEvents
  4. import curses
  5.  
  6. class App(Component):
  7.     ticks=0
  8.     running=True
  9.     max_ticks=20
  10.  
  11.     def __init__(self):
  12.         super(App, self).__init__()
  13.  
  14.     def Hello(self):
  15.         """Hello Event Handler"""
  16.  
  17.         print("Hello World!")
  18.  
  19.     def Tick(self):
  20.         """Tick Event Handler"""
  21.         if self.running:
  22.              if self.ticks <= self.max_ticks:
  23.                  print("TICK", self.ticks)
  24.                  self.ticks+=1
  25.                  self.fire(t1tbEvents.Tick())
  26.              else:
  27.                  self.running=False
  28.         else:
  29.              self.fire(t1tbEvents.Terminate())
  30.  
  31.  
  32.     def Terminate(self):
  33.         raise SystemExit(0)                                                                                                                                                                                                          
  34.     def started(self, *args):
  35.         self.register(self)
  36.         #Debugger.register(self)
  37.         self.fire(t1tbEvents.Tick())
  38.  
  39.  
  40. App().run()  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement