TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Embedding the Python Interpreter in a Qt Application

47 pointsby istotexabout 8 years ago

6 comments

FigBugabout 8 years ago
I looked at doing this several years ago on Windows and I seem to recall that Python had a lot of global state. So you could only have one instance of the Python VM and therefore only Python script running at once. Is this still the case?<p>In the end, for me, it was easier to share file formats between the C++ and Python and run the Python scripts out of process.
评论 #13863801 未加载
评论 #13863058 未加载
doucheabout 8 years ago
If you have the luxury of using .NET, embedding IronPython is considerably easier, in my experience. A while back I was fooling around writing a game engine with python scripting support, and it was pretty slick to get going with.
评论 #13864628 未加载
Liuserabout 8 years ago
Piggy backing off this a little, in a similar vain I recently embedded Python in a macOS app (approved by the store) which was a bit of a pain to do. I documented the process as well since I couldn&#x27;t find a full fledged tutorial on it.<p><a href="https:&#x2F;&#x2F;medium.com&#x2F;python-pandemonium&#x2F;embedding-a-python-application-in-macos-d866adfcaf94#.1396ywujo" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;python-pandemonium&#x2F;embedding-a-python-app...</a>
deftabout 8 years ago
Something like this can be (could be?) done with a BlackBerry 10 application. I developed a hackernews client with a python backend and Qt QML frontend. Didn&#x27;t involve embedding the interpreter as BB10 shipped with python3.2<p><a href="https:&#x2F;&#x2F;bitbucket.org&#x2F;microcode&#x2F;blackberry-py&#x2F;" rel="nofollow">https:&#x2F;&#x2F;bitbucket.org&#x2F;microcode&#x2F;blackberry-py&#x2F;</a> <a href="http:&#x2F;&#x2F;blackberry-py.microcode.ca&#x2F;" rel="nofollow">http:&#x2F;&#x2F;blackberry-py.microcode.ca&#x2F;</a>
sreanabout 8 years ago
Has the embedding story improved for Python 3.* ? Whereas extending Python is easy enough, embedding has not been that convenient. Tcl, Guile, Lua do a far better job.<p>If anyone has drops of wisdom on how to run an embedded Python as a filter or an iterator I would be super interested to know.
fernlyabout 8 years ago
What&#x27;r the choice points between doing this, and building a Qt app using PyQt (or PySide)? Again all the logic is in Python, no C++ whatever. And use PyInstaller or cxFreeze to make a standalone app for distribution.