#!/usr/bin/python import sys,os sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), '..', 'src'))) import pyworlds.worlds as w import pyworlds.basics.body as b import soya.sdlconst as c import soya.pudding as pudding import soya w.init_pudding() # create a vertical container c = pudding.container.VerticalContainer(soya.root_widget, left=10, top=10, width=100, height=100) c.right = 10 # here we' set the anchors. anchors make resizable screen components a doddle # here we anchor all but the bottom to make a sort of title bar c.anchors = pudding.ANCHOR_RIGHT | pudding.ANCHOR_TOP | pudding.ANCHOR_LEFT # add a button # the last argument indicates if the object is free to expand with the container d = c.add_child(pudding.control.Button(label = 'Button'), 1) # set the background color for show d.background_color = (0.3, 0.5, 0.3, 0.5) # add another button but this time specifiy that its not free to grow excpet in the # horizontal d = c.add_child(pudding.control.Input(height = 40, initial = 'input'), pudding.EXPAND_HORIZ) d.background_color = (0.8, 0.5, 0.5, 0.5)
#!/usr/bin/python import sys,os sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), '..', 'src'))) import pyworlds.worlds as w import pyworlds.basics.body as b import soya.sdlconst as c import soya.pudding as pudding import soya w.init_pudding(options={'nochild' : True}) r = pudding.container.HorizontalContainer(soya.root_widget, left=0, top=0, width=200, height=400) r.bottom = 0 r.anchors = pudding.ANCHOR_ALL soya.root_widget.add_child(w.camera) # this time we just anchor one side c.anchors = pudding.ANCHOR_BOTTOM # create a vertical container c = pudding.container.VerticalContainer(r, left=10, top=10, width=100, height=100) c.right = 10 # here we' set the anchors. anchors make resizable screen components a doddle # here we anchor all but the bottom to make a sort of title bar c.anchors = pudding.ANCHOR_RIGHT | pudding.ANCHOR_TOP | pudding.ANCHOR_LEFT | pudding.ANCHOR_BOTTOM # add a button