Ooh, made some minor changes to the code and got masked windows in. Probably can’t go by this route to get decent speed though. You can see the redraws on it, nasty.
Code changes, copy/paste friendly
...
class QtPandaWidget(QtGui.QWidget):
"""
This takes a texture from Panda and draws it as a QWidget
"""
def __init__(self, texture, parent=None):
QtGui.QWidget.__init__(self, parent)
self.setGeometry(50, 50, 800, 600)
self.setWindowTitle("PandaQt")
self.setWindowFlags(self.windowFlags() | QtCore.Qt.FramelessWindowHint) # Setup the window so its frameless
self.pandaTexture = texture
...
# Use the paint event to pull the contents of the panda texture to the widget
def paintEvent(self, event):
screenData = StringStream() # Used to pass the data as a string
screenImage = PNMImage() # Converts the texture data into a format usable with Qt
if self.pandaTexture.mightHaveRamImage(): #ambigious!
print "Should draw yes?"
self.pandaTexture.store(screenImage)
print "Has alpha?",screenImage.hasAlpha()
screenImage.write(screenData, "test.png")
self.paintPixmap.loadFromData(screenData.getData())
self.paintSurface.setPixmap(self.paintPixmap)
self.setMask(self.paintPixmap.mask())
...