473,387 Members | 1,798 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,387 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 5479
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.