def handleAnswer( self, message ): printMessage( message ) self.n = self.n + 1 print "N =", self.n if self.n == 2: self.boss.stopReadingBoth() main.shutDown()
def handleAnswer(self, message): printMessage(message) self.n = self.n + 1 print "N =", self.n if self.n == 2: self.boss.stopReadingBoth() main.shutDown()
def tick(self): try: pyui.core.update() pyui.core.draw() except: #TODO: handle exceptions properly! print "Exception in pyui" raise main.addTimeout(self.tick, 0.001) if not getDesktop().running: main.shutDown() pyui.quit() now = time.time() if now - self.last > 1: print "FPS:", self.frames self.frames = 0 self.last = now self.frames = self.frames + 1
# make sure we can be shut down on windows. main.addTimeout(tick, 0.5) # create the boat frame w = pyui.boat.BoatReflectorFrame(reflector, 0,0,790, 570) # run the main loop last = 0 frame = 0 try: while pyui.update(): pyui.draw() main.iterate() frame += 1 now = time.time() if now - last > 2: print "FPS: ", int(frame/2) frame=0 last=now except: print "ERROR:" traceback.print_exc() # done. quit now. pyui.quit() reactor.stop() main.iterate() main.iterate() main.shutDown() print "done Twisted shutdown"
def gotNoObject(reason): print "no object:",reason main.shutDown()
def gotEcho(echo): print 'server echoed:',echo main.shutDown()
def failure(error): print "Failure...",error main.shutDown()
def success(message): print "Message received:",message main.shutDown()
def printFailure(): print "error: could not resolve" main.shutDown()
def printAnswer(answer): print answer main.shutDown()
def failure(error): print "Failure...", error main.shutDown()
def success(message): print "Message received:", message main.shutDown()