ultimatepp/bazaar/PyTest/main.cpp
kohait 6ecf478516 bazaar: Python: some python test cases, very basic and alpha
git-svn-id: svn://ultimatepp.org/upp/trunk@3319 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2011-03-30 21:04:06 +00:00

33 lines
573 B
C++

#include "PyTest.h"
void SimpleCall()
{
Cout() << "Invoking a python statement:" << EOL;
PyRun_SimpleString( "from time import time,ctime\n"
"print 'Today is',ctime(time())\n");
PyRun_SimpleString(String("print 'python can calculate', 2+3"));
}
void StartConsole()
{
PyRun_SimpleString( "import code\n"
"code.interact()\n");
}
CONSOLE_APP_MAIN
{
Cout() << "Starting Python..." << EOL;
SimpleCall();
EmbedPython();
ExtendPython();
StartConsole();
//leftover
DestroyNewModule();
Cout() << "DONE." << EOL;
}