File: pudding-console-2.py

package info (click to toggle)
soya-doc 0.11.1-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,080 kB
  • ctags: 805
  • sloc: python: 3,380; makefile: 5
file content (53 lines) | stat: -rw-r--r-- 1,106 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -*- indent-tabs-mode: t -*-

#!/usr/bin/env python

""" a complete python console in soya """

import sys, os


import soya
import soya.pudding as pudding
import soya.pudding.python_console

soya.init(width = 800, height = 600)
soya.path.append(os.path.join(os.path.dirname(sys.argv[0]), "data"))

# initialise pudding
pudding.init()

pudding.STYLE.background_color = (.2, .2, .2, .4 )

scene = soya.World()

camera = soya.Camera(scene)

root = pudding.core.RootWidget(width = 640, height = 480)
soya.set_root_widget(root)

panel = pudding.control.Panel(root, left = 10, top = 10, label = "console")
panel.right = 10
panel.bottom = 380
panel.anchors = pudding.ANCHOR_ALL

console = pudding.python_console.PythonConsole(panel, left=10, top=30, lokals = locals())
console.right=10
console.bottom=10
console.anchors = pudding.ANCHOR_ALL
console.input.border_width = 0

root.add_child(camera)

# we need to do this to force the layout to refresh
root.on_resize()


class Idler(soya.Idler):
	def begin_round(self):
		soya.Idler.begin_round(self)

		pudding.process_event()

pudding.idler.Idler(scene).idle()