Sharedwww / talks / 2006-05-09-sage-digipen / tutorial / pudding-z-index-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
8
soya.init()
9
pudding.init()
10
11
scene = soya.World()
12
scene.atmosphere = soya.Atmosphere()
13
scene.atmosphere.bg_color = (1.0, 1.0, 1.0, 1.0)
14
camera = soya.Camera(scene)
15
16
root = pudding.core.RootWidget(width=640, height=480)
17
18
box1 = pudding.control.Box(root,
19
left=150, top=150, width=340, height=180,
20
background_color=(1.0, 0.0, 0.0, 1.0),
21
z_index=0)
22
23
box2 = pudding.control.Box(root,
24
left=100, top=100, width=200, height=280,
25
background_color=(0.0, 1.0, 0.0, 1.0),
26
z_index=-1)
27
28
box3 = pudding.control.Box(root,
29
left=340, top=100, width=200, height=280,
30
background_color=(0.0, 0.0, 1.0, 1.0),
31
z_index=1)
32
33
root.add_child(camera)
34
soya.set_root_widget(root)
35
pudding.idler.Idler(scene).idle()
36