Sharedwww / talks / 2006-05-09-sage-digipen / tutorial / pudding-image-slicing-1.pyOpen in CoCalc
Author: William A. Stein
1
#!/usr/bin/env python
2
3
import sys, os, PIL.Image
4
5
import soya
6
import soya.pudding as pudding
7
import soya.pudding.ext.slicingimage
8
9
soya.init()
10
soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))
11
12
pudding.init()
13
14
scene = soya.World()
15
scene.atmosphere = soya.Atmosphere()
16
scene.atmosphere.bg_color = (1.0, 1.0, 1.0, 1.0)
17
camera = soya.Camera(scene)
18
19
w = pudding.core.RootWidget(width = 640,height = 480)
20
21
# note that the image dimensions are 312 x 132!
22
pil_logo = PIL.Image.open(os.path.join(os.path.dirname(__file__),
23
'data/images/oomad.png'))
24
logo = pudding.ext.slicingimage.SlicingImage(w, pil_logo, left=100, top=100)
25
26
w.add_child(camera)
27
soya.set_root_widget(w)
28
pudding.idler.Idler(scene).idle()
29