[PyQt] problem creating QApplication with argb visual

Lev Shamardin shamardin at gmail.com
Fri May 30 20:02:54 BST 2008


On 05/30/2008 10:31 PM, David Boddie wrote:
 > I tried your code on three different X servers: the one I use on my display,
 > another that's being used via VNC, and a third that is being displayed with
 > Xephyr. The first two gave me this traceback:
 >
 >>>> app = QArgbApplication([])
 > screen: 0
 > eventBase: 0 errorBase: 180
 > nvi: 0
 > Traceback (most recent call last):
 >   File "<stdin>", line 1, in <module>
 >   File "/home/dboddie/python/pastebin.ca-1034001.py", line 120, in __init__
 >     self.__visual = visual
 > UnboundLocalError: local variable 'visual' referenced before assignment
This seems to be normal, that code does not handle correctly the case when 
XRenderQueryExtension fails.

 > The one used with Xephyr gave me this before terminated the Python process:
 >
 > screen: 0
 > eventBase: 0 errorBase: 136
 > nvi: 1
 > visual = 0x08277a48, colormap = 0x00e00001
 > ext_data None visualid 57 c_class 4 red_mask 16711680 green_mask 65280 
blue_mask 255 bits_per_rgb 8 map_entries 256
 > Found ARGB visual, starting app...
 > Alarm clock

Could you please test again with the following snippet and commenting out line 
#132 from the paste (setting the self-destruction alarm):

from qargb import QArgbApplication
from PyQt4.QtGui import QMainWindow

app = QArgbApplication()
mw = QMainWindow()
mw.show()
app.exec_()

If it draws a window without any complaints on your system this seems to be a 
PyQt bug :(

 > I have no idea whether your code is doing all the right things with Xlib.
 > For testing purposes, I just assumed that it is, but I think you may need to
 > ask a Python Xlib guru. (Maybe there are a few reading this list.)

Well, this code is a straightforward translation of sources from 
svn://labs.trolltech.com/svn/graphics/dojo/argb so everything seems to be fine 
from the Xlib side. Either I've done something wrong with types conversions or 
this is a bug.

-- 
Lev.



More information about the PyQt mailing list