Sharedwww / talks / 2006-05-09-sage-digipen / tutorial / pudding-input-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(width = 1024, height = 768)
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
i = pudding.control.Input(w, 'sometext', top = 10, left = 10, width = 100, height = 50)
33
34
w.add_child(camera)
35
36
soya.set_root_widget(w)
37
38
pudding.idler.Idler(scene).idle()
39
40