def doModal(self, close=True): assert self.parent and self.window is self.parent and self.breakLoop self.retValue = False self.breakLoop = False self.setFocus() self.show() window = self.window window.hideToolTips() # set popup popupPool = window._popups popupPool.append(self) self.retClose = close window.prohibitSizing.set(self) koan.run(id(self)) window.prohibitSizing.reset(self) # relese popup popupPool.remove(self) if popupPool: for i in popupPool[-1::-1]: if not i.dead: i.setFocus() break return self.retValue
def doModal(self, close = True): assert self.parent and self.window is self.parent and self.breakLoop self.retValue = False self.breakLoop = False self.setFocus() self.show() window = self.window window.hideToolTips() # set popup popupPool = window._popups popupPool.append(self) self.retClose = close window.prohibitSizing.set(self) koan.run(id(self)) window.prohibitSizing.reset(self) # relese popup popupPool.remove(self) if popupPool: for i in popupPool[-1::-1]: if not i.dead: i.setFocus() break return self.retValue
o = Component(b) o.size = 64, 64 o.bgColor = (255, randint(0,255), randint(0,255), randint(0,255)) o = Component(b) o.size = 64, 64 o.bgColor = (255, randint(0,255), randint(0,255), randint(0,255)) o = Component(b) o.size = 64, 64 o.bgColor = (255, randint(0,255), randint(0,255), randint(0,255)) # autohide toolbar b = AutoHideToolbar(c) b.autosize = False b.height = 100 b.bgColor = color.darkblue o = Component(b) o.size = 64, 64 o.bgColor = (255, randint(0,255), randint(0,255), randint(0,255)) o = Component(b) o.size = 64, 64 o.bgColor = (255, randint(0,255), randint(0,255), randint(0,255)) o = Component(b) o.size = 64, 64 o.bgColor = (255, randint(0,255), randint(0,255), randint(0,255)) w.show() koan.run(1) koan.final()
if key == 'F1': dlg = Dialog(self) dlg.bgColor = color.darkgray dlg.rect = 100, 100, 400, 300 ret = dlg.doModal() print dlg.children return True elif key == 'F2': dlg = Dialog(self) dlg.bgColor = color.darkgray dlg.rect = 100, 100, 400, 300 ret = dlg.doModal(close=False) print dlg.children dlg.close() # you should call close by yourself return True return super(MyWindow, self).onKey(key) w = MyWindow() w.create(0, 0, 640, 480, caption=True) w.bgColor = color.black w.show() e = None w = None koan.run(1) koan.final() koan.traceLeak()
if self._step_by_step_flag: self._step_by_step_flag = False return # Update the new location of the plate if self._target_left > self._plate_images[self._move.number].left: self._plate_images[self._move.number].left += HORIZONTAL_SPEED elif self._target_left < self._plate_images[self._move.number].left: self._plate_images[self._move.number].left -= HORIZONTAL_SPEED self._time_spent += 1 self._plate_images[self._move.number].top = self._starting_top + VERTICAL_SPEED * self._time_spent + self._acceleration * (self._time_spent ** 2) / 2 def close(self): # Remove the registered animation self._animation.remove() super(HanoiWindow, self).close() def onDraw(self, render): render.Clear(255, 0, 0, 0) if __name__ == '__main__': koan.init() w = HanoiWindow() w.allSightDirty = 0 w.show() koan.run(0)
if self._step_by_step_flag: self._step_by_step_flag = False return # Update the new location of the plate if self._target_left > self._plate_images[self._move.number].left: self._plate_images[self._move.number].left += HORIZONTAL_SPEED elif self._target_left < self._plate_images[self._move.number].left: self._plate_images[self._move.number].left -= HORIZONTAL_SPEED self._time_spent += 1 self._plate_images[ self._move. number].top = self._starting_top + VERTICAL_SPEED * self._time_spent + self._acceleration * ( self._time_spent**2) / 2 def close(self): # Remove the registered animation self._animation.remove() super(HanoiWindow, self).close() def onDraw(self, render): render.Clear(255, 0, 0, 0) if __name__ == '__main__': koan.init() w = HanoiWindow() w.allSightDirty = 0 w.show() koan.run(0)