using python extension(wxpython) in c

Joined
Oct 27, 2006
Messages
3
Reaction score
0
there is a python gui script,whose GUI part is in wxPython. and now i want it to be used in c, so what shall i do,if i install wxPython from exe or source code?
furthermore if i use the latter option, then how shall i place the build products? like vc_dll(contains the wxWidgets build product),wx(contain the wxPython build product,mainly .pyds and .pdbs).and also wxPythnon directory to make the script function normally?

#include "python.h"
#include "wx/wxPython/wxPython.h"
#include <iostream>
using namespace std;

int main()
{
Py_Initialize();
if(!Py_IsInitialized())
{
cerr << "hello,world!"<< endl;
return -1;
}
PyRun_SimpleString("from wxPython.wx import *");
PyRun_SimpleString("class myApp(wxApp):");
PyRun_SimpleString(" def OnInit(self):");
PyRun_SimpleString(" frame = wxFrame(NULL,-1,"hello,world!")");
PyRun_SimpleString(" frame.Show(true)");
PyRun_SimpleString(" self.SetTopWindow(frame)");
PyRun_SimpleString(" return true");
PyRun_SimpleString("app = myApp()");
PyRun_SimpleString("app.MainLoop()");
Py_Finalize();
return 0;
}
thanks if any feedbacks.
regards,
jolley
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top