Sharedwww / talks / 2006-05-09-sage-digipen / tutorial / pudding-buttonbar-1.pyOpen in CoCalc
Author: William A. Stein
1
#!/usr/bin/env python
2
3
import sys, os
4
5
import soya
6
import soya.pudding as pudding
7
8
soya.init()
9
soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))
10
11
# initialise pudding
12
pudding.init()
13
14
scene = soya.World()
15
16
sword_model = soya.Shape.get("sword")
17
sword = soya.Volume(scene, sword_model)
18
sword.x = 1
19
sword.rotate_lateral(90.)
20
21
# one line rotation :)
22
sword.advance_time = lambda p: sword.rotate_lateral(5.*p)
23
24
light = soya.Light(scene)
25
light.set_xyz( .5, 0., 2.)
26
27
camera = soya.Camera(scene)
28
camera.z = 3.
29
30
w = pudding.core.RootWidget(width = 1024,height = 768)
31
32
button_bar = pudding.container.HorizontalContainer( w, left = 10, width= 164, height=64)
33
button_bar.set_pos_bottom_right(bottom = 10)
34
button_bar.anchors = pudding.ANCHOR_BOTTOM
35
36
d = button_bar.add_child(pudding.control.Button(label = 'Button1'), pudding.EXPAND_BOTH)
37
f = button_bar.add_child(pudding.control.Button(label = 'Button2'), pudding.EXPAND_BOTH)
38
f.right = 130
39
40
#logo = pudding.control.Logo(w, 'little-dunk.png')
41
42
w.add_child(camera)
43
44
soya.set_root_widget(w)
45
46
pudding.idler.Idler(scene).idle()
47
48