I have been dealing with the qt programming using Python. Till now i mainl created simple GUI working as a on screen display or making simple jobs. I was trying to creade an on screen display. I needed to create transparent window application. After searching and trying here is a simple python code that uses qt4 library that creates a window which includes a transparent png image inside.
from PyQt4 import QtGui, Qt, QtCore
pixmap = QtGui.QPixmap("test.png")
width = pixmap.width()
height = pixmap.height()
self.label = QtGui.QLabel(self)
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
x = Transparent()
Just stumbled across your site here whilst looking at creating a transparent window — I want to create a simple application that can sit just above the root window and display system stats. (If it works out, I’ll probably release the code for everyone too).
There’s one slight problem with your above code — it’s not indented. With C, Perl or other languages, that wouldn’t matter too much… but with Python — it’s imperative that the code is properly indented, since Python relies on this for parsing code blocks.
WordPress provides a
tag for displaying code... could you perhaps re-post the above using that, or alternatively, attach a plaintext file one can download?
You are right. But it seems this template is not supporting the code tag. I edited the entry but still it is not intended.
So here is the link that you can check the source intended: http://pastebin.com/f45bb76e0
i’ve been looking for something like this for a few days and have been getting wrapped up a whole win32api UpdateLayeredWindow trainwreck. i wish i had come across this simple solution earlier. thanks!
also, to get the right indentation you could just look at the html source. (or you could use “pre” tags.)
for indention I google for a htmlencoder and paste my code in there, it encodes it so that the indents are hard coded, then wrap it in a PRE tag and CODE tag.
Thanks for the code by the way I’m going to use it to make a callcentre script prompter 🙂
Nice one, that actually worked !!! Thanks !
Could u help me for creating a transparent window with frame. something like glassy appearance…
I haven’t been dealing with the qt programming for a while. Sorry.