def TestStackPanel(w): s = StackPanel(w) #s.orientation = 'Horizontal' s.center = True s.bind('Mouse Wheel', s.onScroll) #s.autosize = True s.rect = 50, 50, 600, 170 s.bgColor = color.gray c = Component(s) c.size = 250, 50 c.bgColor = color.red c = Component(s) c.size = 300, 50 c.bgColor = color.green c = Component(s) c.size = 300, 300 c.bgColor = color.blue
c.size = 400, 300 b = Caption(c) #b.bindData('width', c, 'width', dir = '<-') b.height = 50 b.bgColor = color.lightgray # toolbar b = Toolbar(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)) # autohide toolbar b = AutoHideToolbar(c) b.autosize = False b.height = 100 b.bgColor = color.darkblue o = Component(b) o.size = 64, 64
def TestDockPanel(w): d = DockPanel(w) d.bindData('width', w, 'width', dir='<-') d.bindData('height', w, 'height', dir='<-') s = StackPanel(d) s.bgColor = color.red s.width = 100 p = DockSplitter(d) p.bgColor = color.darkgray s1 = StackPanel(d) s1.bgColor = color.green s1.height = 100 #d.dock(s1, 'top') p = DockSplitter(d) p.bgColor = color.darkgray s2 = StackPanel(d) s2.bgColor = color.blue s2.width = 100 #d.dock(s2, 'right') p = DockSplitter(d) p.bgColor = color.darkgray s3 = StackPanel(d) s3.bgColor = color.yellow s3.height = 100 #d.dock(s3, 'bottom') p = DockSplitter(d) p.bgColor = color.darkgray d.dock(s, 'left') d.dock(s1, 'top') d.dock(s2, 'right') d.dock(s3, 'bottom') d = DockPanel(d) s = StackPanel(d) s.bgColor = color.red s.width = 100 p = DockSplitter(d) p.bgColor = color.darkgray s1 = StackPanel(d) s1.bgColor = color.green s1.height = 100 #d.dock(s1, 'top') p = DockSplitter(d) p.bgColor = color.darkgray s2 = StackPanel(d) s2.bgColor = color.blue s2.width = 100 #d.dock(s2, 'right') p = DockSplitter(d) p.bgColor = color.darkgray s3 = StackPanel(d) s3.bgColor = color.yellow s3.height = 100 #d.dock(s3, 'bottom') p = DockSplitter(d) p.bgColor = color.darkgray c = Canvas(d) c.bgColor = color.white #d.dock(c, 'left') o = Component(c) o.bgColor = color.darkblue o.size = 200, 30 o1 = Component(c) o1.bgColor = color.red o1.size = 50, 50 o2 = Component(c) o2.bgColor = color.green o2.size = 50, 50 o3 = Component(c) o3.bgColor = color.blue o3.size = 50, 50 o4 = Component(c) o4.bgColor = color.purple o4.size = 50, 50 d.dock(s, 'left') d.dock(s1, 'top') d.dock(s2, 'right') d.dock(s3, 'bottom') c.dock(o, {'horz': True, 'vert': True}) c.dock(o1, {'left': 10, 'top': 10}) c.dock(o2, {'right': 10, 'top': 10}) c.dock(o3, {'right': 10, 'bottom': 10}) c.dock(o4, {'left': 10, 'bottom': 10})
c.size = 400, 300 b = Caption(c) #b.bindData('width', c, 'width', dir = '<-') b.height = 50 b.bgColor = color.lightgray # toolbar b = Toolbar(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)) # autohide toolbar b = AutoHideToolbar(c) b.autosize = False b.height = 100 b.bgColor = color.darkblue o = Component(b) o.size = 64, 64
def TestDockPanel(w): d = DockPanel(w) d.bindData('width', w, 'width', dir = '<-') d.bindData('height', w, 'height', dir = '<-') s = StackPanel(d) s.bgColor = color.red s.width = 100 p = DockSplitter(d) p.bgColor = color.darkgray s1 = StackPanel(d) s1.bgColor = color.green s1.height = 100 #d.dock(s1, 'top') p = DockSplitter(d) p.bgColor = color.darkgray s2 = StackPanel(d) s2.bgColor = color.blue s2.width = 100 #d.dock(s2, 'right') p = DockSplitter(d) p.bgColor = color.darkgray s3 = StackPanel(d) s3.bgColor = color.yellow s3.height = 100 #d.dock(s3, 'bottom') p = DockSplitter(d) p.bgColor = color.darkgray d.dock(s, 'left') d.dock(s1, 'top') d.dock(s2, 'right') d.dock(s3, 'bottom') d = DockPanel(d) s = StackPanel(d) s.bgColor = color.red s.width = 100 p = DockSplitter(d) p.bgColor = color.darkgray s1 = StackPanel(d) s1.bgColor = color.green s1.height = 100 #d.dock(s1, 'top') p = DockSplitter(d) p.bgColor = color.darkgray s2 = StackPanel(d) s2.bgColor = color.blue s2.width = 100 #d.dock(s2, 'right') p = DockSplitter(d) p.bgColor = color.darkgray s3 = StackPanel(d) s3.bgColor = color.yellow s3.height = 100 #d.dock(s3, 'bottom') p = DockSplitter(d) p.bgColor = color.darkgray c = Canvas(d) c.bgColor = color.white #d.dock(c, 'left') o = Component(c) o.bgColor = color.darkblue o.size = 200, 30 o1 = Component(c) o1.bgColor = color.red o1.size = 50, 50 o2 = Component(c) o2.bgColor = color.green o2.size = 50, 50 o3 = Component(c) o3.bgColor = color.blue o3.size = 50, 50 o4 = Component(c) o4.bgColor = color.purple o4.size = 50, 50 d.dock(s, 'left') d.dock(s1, 'top') d.dock(s2, 'right') d.dock(s3, 'bottom') c.dock(o, {'horz':True, 'vert':True}) c.dock(o1, {'left':10, 'top':10}) c.dock(o2, {'right':10, 'top':10}) c.dock(o3, {'right':10, 'bottom':10}) c.dock(o4, {'left':10, 'bottom':10})