0

I've made a gui and am wondering how I would go about embedding a C++ program inside a section of the gui. So for example, from my MainWindow, if you click 'start game' a new window opens up with some graphical display, and the c++ game is embedded/executed within it. I've seen some articles about wrappers and using python in c++, but I don't have a good understanding of it, so I'm not sure that those apply to me in this case. If this is possible, should it be a .cpp or .exe? I'm more inclined to think it should be an executable file, but clearly I have no idea what I'm doing. I would greatly appreciate any help or guidance.

1
  • .cpp files are just text files... you need to compile you program into either an executable or a library for python to call Commented Dec 19, 2016 at 19:38

1 Answer 1

1

The easiest solution here is to create a standalone application in cpp that is simply called by your python gui with a system call: os.system(). if you instead create a library (DLL) and wrap it into a python library with something like swig you can call functions directly and potentially wrap something like a GL renderer into a qt frame widget (if you want a 3d render widget this has been done before so don't waste your time re-inventing the wheel)

Sign up to request clarification or add additional context in comments.

1 Comment

I already have the cpp, is it just a one line call :os.system(path) or do I need to add something else so Python knows what to do with it? Sorry for such a 'hand-holding' question but I'm not at all familiar with it and need to have it ready in a couple of hours(if I can even manage). Thank you for your help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.