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) #b.bindData('width', c, 'width', dir = '<-') b.height = 50 b.bgColor = color.lightgray
self.invoke('Input Finish') return True return super(RichEdit, self).onKey(key) Edit = RichEdit if __name__ == '__main__': from window import Window from pprint import pprint koan.init() w = Window() w.create(0, 0, 640, 480, caption = True) w.bgColor = color.darkgray w.bind('Key', pprint) e = Edit(w) e.rect = 10,10,300,200 e.align = 'MTL' e.vscroll = False e.font = 'Segoe UI' e.hscroll = False #e.bgColor = color.lightgray e.bgColor = color.darkblue e.fontColor = color.green #koan.anim.PostEvent(setattr, e, 'text', 'Testing, hello world') e.maxlen = 5 e.text = 'Hello world'
# display #------------------------------------------------- def onDraw(self, render): super(Combobox, self).onDraw(render) TextBase.onDraw(self, render) if __name__ == '__main__': from window import Window from panel import StackPanel koan.init() w = Window() w.create(0, 0, 400, 600, True) w.bgColor = color.darkgray p = StackPanel(w) p.bindData('width', w, 'width', dir='<-') p.bindData('height', w, 'height', dir='<-') # button b = Button(p) b.tips = 'Button' b.bgColor = color.darkblue b.height = 30 # text button tb = TextButton(p) tb.bgColor = color.darkred tb.fontColor = color.white
self.bind('Mouse Down', self.trace, 'Mouse Down') self.bind('Mouse Up', self.trace, 'Mouse Up') self.bind('Mouse RDown', self.trace, 'Mouse RDown') self.bind('Mouse RUp', self.trace, 'Mouse RUp') self.bind('Click', self.trace, 'Click') self.bind('Dbl Click', self.trace, 'Dbl Click') self.bind('RDbl Click', self.trace, 'RDbl Click') def trace(self, *argv, **argd): print self, argv koan.init() w = Window() w.create(0, 0, 800, 600, caption = True) w.bgColor = color.darkblue from dialog import Dialog from pprint import pprint w.d = Dialog(w) w.d.bind('Mouse Enter', pprint, 'Mouse Enter') w.d.bind('Mouse Leave', pprint, 'Mouse Leave') w.d.size = 400, 300 w.d.bgColor = color.blue w.bind('Key', koan.action.PureAction(w.d.doModal)) o = MyComponent(w.d) o.rect = 100, 50, 300, 100 o.bgColor = color.yellow w.show()
StackPanel.__init__(self, parent) self.orientation = 'Horizontal' self.bgColor = color.lightgray self.clip = False self.press = False if __name__ == '__main__': import koan from window import Window koan.init() w = Window() w.create(0, 0, 800, 600, caption=True) w.bgColor = color.darkblue def popup(x, y, flag): import time t = time.time() m = PopupMenu(w) m.margin = 0, 10 def createMenuItem(m, text): mi = MenuItem(m) mi.fontColor = color.white mi.fontSize = 20 mi.header = text mi.bgColor = color.gray mi.bind('Mouse Enter', setattr, mi, 'bgColor', color.lightgray)
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) #b.bindData('width', c, 'width', dir = '<-') b.height = 50 b.bgColor = color.lightgray