1 """an example a python console"""
4 from pygame.locals import *
6 # the following line is not needed if pgu is installed
7 import sys; sys.path.insert(0, "..")
18 self._data = self._data+data
19 _lines = self._data.split("\n")
20 for line in _lines[:-1]:
22 lines.td(gui.Label(str(line)),align=-1)
23 self._data = _lines[-1:][0]
30 s = sys.stdout = StringStream()
37 code = compile(val,'<string>','single')
38 eval(code,globals(),_locals)
40 e_type,e_value,e_traceback = sys.exc_info()
41 print('Traceback (most recent call last):')
42 traceback.print_tb(e_traceback,None,s)
48 t = gui.Table(width=500,height=400)
52 box = gui.ScrollArea(lines,500,380)
56 line = gui.Input(size=49)
57 line.connect(gui.KEYDOWN,lkey)
61 class Hack(gui.Spacer):
62 def resize(self,width=None,height=None):
63 box.set_vertical_scroll(65535)
67 app.connect(gui.QUIT,app.quit,None)