[PyQt] problem creating QApplication with argb visual

Neal Holtz nholtz at cee.carleton.ca
Tue Jun 10 13:23:10 BST 2008


On Fri, 30 May 2008 04:59:28 -0700,  Lev Shamardin wrote:

>  Fri, 30 May 2008 04:59:28 -0700
> Hi all,
> I'm trying to port ARGB window example
> (http://labs.trolltech.com/page/Graphics/Examples/Examples1) to PyQt4. I've
> wrapped all calls to Xlib with ctypes, and now stuck with the following
> problem:

Hi,

I had started this independently before I found this thread,
so I've done things a bit differently.  Bottom line is this
(where widget.py is pretty well an 'exact' copy of widget.cpp
in the original).  If my main program is entirely this:

import sys
from PyQt4 import QtGui
from widget import Widget

app = QtGui.QApplication(sys.argv+['-visual','TrueColor','-cmap'])

w = Widget()
w.resize( 400, 300 )
w.show()

app.exec_()

then the application almost works.  In fact, the window that appears
is correct, with transparent and translucent areas just like the
original c++ version.  Of course, this doesn't attempt to detect whether ARGB
is available (I wonder if QApplication is nice enough to raise an exception...)

The only thing, is, the first time the mouse ptr is first moved into the window, I get:

X Error: BadMatch (invalid parameter attributes) 8
  Extension:    157 (RENDER)
  Minor opcode: 4 (RenderCreatePicture)
  Resource id:  0x188

just once.  

And when I close the window, I get, once:

X Error of failed request:  RenderBadPicture (invalid Picture parameter)
  Major opcode of failed request:  157 (RENDER)
  Minor opcode of failed request:  7 (RenderFreePicture)
  Picture id in failed request: 0x46004a1
  Serial number of failed request:  6108
  Current serial number in output stream:  6138

After all the fighting I've been doing trying to learn PyQt and get transparent
top windows at the same time, I can live with that.

Now, when I use my version of the copy of the c++ main program, that
uses Xlib and a lot of mucking about trying to get displays and visuals
and colormaps, when I try to open the app with

    app = QtGui.QApplication( qt_dpy, qt_visual, qt_colourmap )

I get lots of X Errors and no window.  But I've undoubtedly mucked up the ctypes
wrapping, somewhere.

When I start with:

    app = QtGui.QApplication( qt_dpy, sys.argv+['-visual','TrueColor','-cmap'] )

I get proper window behaviour excpet for *one* X Error BadMatch as above.
There is no 'RenderBadPicture' error when the window is closed.

Also, when I use this opening, in the window manager the window is labelled:
'Qt-Subapplication'.

When the app is opened this way (without the Display pointer frist arg):

    app = QtGui.QApplication( sys.argv+['-visual','TrueColor','-cmap'] )

the window is  labelled with the name of the Python source file, and we get
the one additional error message on close.

I'm just reporting -- I don't understand any of this  :-(

Simple version of the almost working example is attached.

-- 
Neal Holtz                            http://cee.carleton.ca/~nholtz
Dept. of Civil and Environmental Engineering     Carleton University
Ottawa, Ontario, Canada K1S 5B6.              nholtz at cee.carleton.ca
Key: http://cee.carleton.ca/~nholtz/pubkey.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: argb.zip
Type: application/x-zip
Size: 53477 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080610/2345c382/argb-0001.bin


More information about the PyQt mailing list