Hi everybody :)

I have a big problem with embedded Python. I develop a plugin for a C++ application and want to "teach" this app Python Scripting, that users are able to script their own functions.

the App = The C++ Application
plugin = my plugin I develop for the App

The plugin is a object-class which is registered by the App at startup and after that I am able to create many objects of that. The app allocates for every plugin a memory-space (not editable. more code means more allocated memory.

1. the app works when I enter a Python script that calculates something. (output = input + 1)
that still works

2. the app crashs when I generate via Tkinter or another GUI a GUI window with "hello world" in it. The PyRun_Simplestring command is called in the object class when a method is called by the app

3. the app doesn't crash when I use the same code from point 2, but put it outside the allocated class (for example to the point where the class is registered). The app starts, the GUi shows, and after I close it, everything runs further.

What can I do? When I create my own short command-line C++ Tool with a object-class (which isn't needed to allocate) everything runs too). Only in my plugin in the object-class it crashes :(

PyRun_SimpleString("from Tkinter import *");
PyRun_SimpleString("root = Tk()");
PyRun_SimpleString("w = Label(root, text='Hello, world!')");
PyRun_SimpleString("Outport = 5 ** 4");

Thanks for your biiig help. Thanks



This article has been dead for over six months. Start a new discussion instead.