def catchAndDisplay(cmd): """Catch stdout from a Python cmd and display it in a window.""" save = sys.stdout try: f = tempfile.TemporaryFile('w+') sys.stdout = f eval(cmd) f.seek(0) draw.textView(f.read()) finally: sys.stdout = save
def opengl(): """Display the OpenGL format description.""" draw.textView(viewport.OpenGLFormat())
def license(): """Display the pyFormex description.""" draw.textView(file(GD.cfg['help/license']).read())