idx += 1 if key == 'TAB' else -1 idx = idx % len(children) children[idx].setFocus() return True return super(Dialog, self).passKey(key) ''' def onKey(self, key): if PopupBase.onKey(self, key): return True return super(Dialog, self).onKey(key) if __name__ == '__main__': from window import Window koan.init() class MyWindow(Window): def onKey(self, key): 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)
l = self.capX + x t = self.capY + y self.moveTarget.left = min(max(l, 0), self.moveTarget.parent.width - self.parent.width) self.moveTarget.top = min(max(t, 0), self.moveTarget.parent.height - self.parent.height) if __name__ == '__main__': from window import Window from panel import Canvas, StackPanel from component import Component from random import randint import color koan.init() w = Window() w.create(0, 0, 800, 600, True) w.bgColor = color.black b = Captionbar(w) b.bindData('width', w, 'width', dir = '<-') b.height = 100 b.bgColor = color.darkblue c = StackPanel(w) c.bgColor = color.darkgray c.size = 400, 300 b = Caption(c)
from comp.PlayerWindow import PlayerWindow from Widgets.kxmlparser import loadKXML import koan if __name__ == '__main__': koan.init(); w = PlayerWindow() loadKXML(w, "dsplayer.xml") w.show() koan.run(1) koan.final() pass