Seite 1 von 1

Visual Studio C++ Commandline und wxPython

Verfasst: Samstag 5. Februar 2011, 16:02
von Trokhon
Ich hab folgendes versucht
VisualStudio 2010 , C++ Commandline Anwendung und Python 2.7 mit wxPython2.8-win32-ansi-2.8.11.0-py27 alles 32 bit

Code: Alles auswählen

#include <Python.h>


int main(int argc, char *argv[])
{
    PyObject *pName, *pModule, *pDict, *pFunc, *pValue;
	PyObject *mod;

	Py_Initialize();
	PyRun_SimpleString("import wx");
	mod = PyImport_ImportModule("wx");
	if (mod == NULL)
		printf("Error");
	//return 1;
	pName = PyString_FromString("newwindow");
	
    // Load the module object

    pModule = PyImport_Import(pName); 

    // pDict is a borrowed reference 

    pDict = PyModule_GetDict(pModule);

    // pFunc is also a borrowed reference 
	
    pFunc = PyDict_GetItemString(pDict,"start");
	
    if (PyCallable_Check(pFunc)) 
    {
        PyObject_CallObject(pFunc, NULL);
    } else 
    {
        PyErr_Print();
    }
	
    // Clean up
	
    Py_DECREF(pModule);
    Py_DECREF(pName);
	
	return false;



}

und dann sofort der Fehler

Code: Alles auswählen

  File "C:\Prog\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.py", l
ine 45, in <module>
    from wx._core import *
  File "C:\Prog\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line
 4, in <module>
    import _core_
ImportError: DLL load failed: Das angegebene Modul wurde nicht gefunden.
Error
D.h. es kann nicht einmal das wx importiert werden.

Sollte das überhaupt gehen? Macht es Sinn da weiterzusuchen. Leider habe ich dazu nichts brauchbares gefunden.

Wie könnte ich sonst aus c++ / dll heraus ein Python Fenster anzeigen lassen

Vielen Dank für jede Hilfe

Re: Visual Studio C++ Commandline und wxPython

Verfasst: Sonntag 6. Februar 2011, 15:25
von Dauerbaustelle
Warum machst du nicht gleich alles in Python?