473,287 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

PyQt with embedded python in Qt App

Is it possible for a Qt C++ application, which embeds the python
interpreter, to import and use PyQt? There can be only one
QApplication, which is created in the C++ side, so how would I use
that from the python side?

Nov 1 '07 #1
9 5473
On Thursday 01 November 2007, cgrebeld wrote:
Is it possible for a Qt C++ application, which embeds the python
interpreter, to import and use PyQt? There can be only one
QApplication, which is created in the C++ side, so how would I use
that from the python side?
QtGui.QApplication.instance()

Phil
Nov 1 '07 #2
Thursday 01 of November 2007 15:13:55 Phil Thompson napisał(a):
On Thursday 01 November 2007, cgrebeld wrote:
Is it possible for a Qt C++ application, which embeds the python
interpreter, to import and use PyQt? There can be only one
QApplication, which is created in the C++ side, so how would I use
that from the python side?

QtGui.QApplication.instance()
What I can do with this pointer?
It is possible to add window to application ?
It is possible to connect to application signals?

Bart.
Nov 1 '07 #3
On Thursday 01 November 2007, Bart. wrote:
Thursday 01 of November 2007 15:13:55 Phil Thompson napisał(a):
On Thursday 01 November 2007, cgrebeld wrote:
Is it possible for a Qt C++ application, which embeds the python
interpreter, to import and use PyQt? There can be only one
QApplication, which is created in the C++ side, so how would I use
that from the python side?
QtGui.QApplication.instance()

What I can do with this pointer?
It's not a pointer, it's a Python object that wraps the C++ pointer.
It is possible to add window to application ?
Yes.
It is possible to connect to application signals?
Yes.

Phil
Nov 1 '07 #4
Thursday 01 of November 2007 23:32:02 Phil Thompson napisał(a):
On Thursday 01 November 2007, Bart. wrote:
Thursday 01 of November 2007 15:13:55 Phil Thompson napisał(a):
On Thursday 01 November 2007, cgrebeld wrote:
Is it possible for a Qt C++ application, which embeds the python
interpreter, to import and use PyQt? There can be only one
QApplication, which is created in the C++ side, so how would I use
that from the python side?
>
QtGui.QApplication.instance()
What I can do with this pointer?

It's not a pointer, it's a Python object that wraps the C++ pointer.
So how to pass this object into embeded python interpreter (executed script)?
Anyone know any example?

Nov 1 '07 #5
Bart. schrieb:
Thursday 01 of November 2007 23:32:02 Phil Thompson napisał(a):
>On Thursday 01 November 2007, Bart. wrote:
>>Thursday 01 of November 2007 15:13:55 Phil Thompson napisał(a):
On Thursday 01 November 2007, cgrebeld wrote:
Is it possible for a Qt C++ application, which embeds the python
interpreter, to import and use PyQt? There can be only one
QApplication, which is created in the C++ side, so how would I use
that from the python side?
QtGui.QApplication.instance()
What I can do with this pointer?
It's not a pointer, it's a Python object that wraps the C++ pointer.

So how to pass this object into embeded python interpreter (executed script)?
Anyone know any example?
You don't pass it, you _retrieve_ it in the embedded interpreter by
invoking the code given to you.

Diez
Nov 2 '07 #6
Friday 02 of November 2007 01:06:58 Diez B. Roggisch napisał(a):
So how to pass this object into embeded python interpreter (executed
script)? Anyone know any example?

You don't pass it, you _retrieve_ it in the embedded interpreter by
invoking the code given to you.
Know any example, please?
For better understand this :) I wan't add scripting to one application wrotten
with Qt.

Bart.
Nov 2 '07 #7
On Nov 2, 8:03 am, "Bart." <uz...@o2.plwrote:
Friday 02 of November 2007 01:06:58 Diez B. Roggisch napisa (a):
So how to pass this object into embeded python interpreter (executed
script)? Anyone know any example?
You don't pass it, you _retrieve_ it in the embedded interpreter by
invoking the code given to you.

Know any example, please?
For better understand this :) I wan't add scripting to one application wrotten
with Qt.
So, you have Qt/C++ application which you want to script through
python.

But why do you need PyQt for ? If you design a script api in python
and bind it using whatever binding technology (manually, boost, sip,
pyrex, ...), you should not need to use PyQt.

Or do you mean to use PyQt as the binding technology ?

Philippe

Nov 2 '07 #8
Friday 02 of November 2007 12:21:06 BlueBird napisał(a):
On Nov 2, 8:03 am, "Bart." <uz...@o2.plwrote:
Friday 02 of November 2007 01:06:58 Diez B. Roggisch napisa (a):
So how to pass this object into embeded python interpreter (executed
script)? Anyone know any example?
>
You don't pass it, you _retrieve_ it in the embedded interpreter by
invoking the code given to you.
Know any example, please?
For better understand this :) I wan't add scripting to one application
wrotten with Qt.

So, you have Qt/C++ application which you want to script through
python.

But why do you need PyQt for ? If you design a script api in python
and bind it using whatever binding technology (manually, boost, sip,
pyrex, ...), you should not need to use PyQt.

Or do you mean to use PyQt as the binding technology ?
Or I want to use PyQt in scripts to have similar gui for plugins written in
python
Or I want to extend application by scripts with PyQt.

Or better question:
How to easy add python scripting in Qt application and have almast all objects
of app accesible in scripts?
Kross could be good solution?

I realy need some examples :(
I'm looking for solutions.

You are proffesional programmers so that is why write on this list :)

Thanks for Your answars.

Bart.
Nov 2 '07 #9
On Nov 2, 7:59 am, "Bart." <uz...@o2.plwrote:
Friday 02 of November 2007 12:21:06 BlueBird napisa (a):
On Nov 2, 8:03 am, "Bart." <uz...@o2.plwrote:
Friday 02 of November 2007 01:06:58 Diez B. Roggisch napisa (a):
So how to pass this object into embeded python interpreter (executed
script)? Anyone know any example?
You don't pass it, you _retrieve_ it in the embedded interpreter by
invoking the code given to you.
Know any example, please?
For better understand this :) I wan't add scripting to one application
wrotten with Qt.
So, you have Qt/C++ application which you want to script through
python.
But why do you need PyQt for ? If you design a script api in python
and bind it using whatever binding technology (manually, boost, sip,
pyrex, ...), you should not need to use PyQt.
Or do you mean to use PyQt as the binding technology ?

Or I want to use PyQt in scripts to have similar gui for plugins written in
python
Or I want to extend application by scripts with PyQt.

Or better question:
How to easy add python scripting in Qt application and have almast all objects
of app accesible in scripts?
Kross could be good solution?

I realy need some examples :(
I'm looking for solutions.

You are proffesional programmers so that is why write on this list :)

Thanks for Your answars.

Bart.
Here is an example:
http://python.pastebin.com/m18c67b3a

Nov 3 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dennis Sylvester | last post by:
Interested in any opinions, studies, etc., concerning the GUI tool(s) to use for Python. Specifically, which would you recommend (and why) for building GUI apps in Python: TKinter BOA PyQT ...
3
by: Dave | last post by:
I'm having a strange problem with the pyqt-tools in the latest Debian packages. When I run $ pyuic colortool.ui > colortool.py Extracting init() Extracting loadSettings() Extracting...
8
by: simo | last post by:
OK, so I'm at the stage where I want to make a choice between wxPython and PyQt. Currently I'm using wxPython mainly due to the fact that it has GPL Linux and Windows versions. I prefer Qt to...
10
by: svenn.are | last post by:
Hi, I wanted to run a program that is written in PyQt on my mac, and went over to Riverbank to get PyQ 3.13 and SIP 4.1.1 sources. I followed the installation guide except for the compiling...
10
by: Simon John | last post by:
After quite a while of wxPython I'm getting back into PyQt, mainly due to the announcement by Trolltech that they will make a GPL version of Qt4 for Windows (and Phil-T said he will make a PyQt to...
4
by: Phil Thompson | last post by:
Riverbank Computing is pleased to announce the release of PyQt v3.14 available from http://www.riverbankcomputing.co.uk/. Changes since the last release include support for QScintilla v1.5. ...
17
by: eholbroo | last post by:
I've narrowed down my toolkit selection for my project to wxPython and pyQt, and now i'd like to hear any opinions, war stories, peeves, etc, about them, particularly from anyone who's used...
3
by: Phil Thompson | last post by:
Riverbank Computing is pleased to announce the release of PyQt v4.0beta1 available from http://www.riverbankcomputing.co.uk/pyqt/. PyQt is a comprehensive set of Qt bindings for the Python...
0
by: David Boddie | last post by:
On Fri Nov 2 12:59:48 CET 2007, Bart. wrote: You can use PyQt, Kross or PythonQt for this, but only PyQt will give you a comprehensive API "out of the box". There is code in the PyQt source...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.