I'm to stupid to add aQLabel with (semi-)transparency and to change the font color. Can anyone help with this "simple" question ?
Did some search in Google, but found no answer
Could you be more specific and post any code example you are playing with?
What is your purpose? Shadows for the slideshow? Draw shadows behind text?
Draw text on top of a video like "On Screen Display" OSD.
Because my QMainWindow has a black background, the QLabel inherit this from it. No I have a label with black fonts on a black background :-(
self.player = Phonon.VideoPlayer(Phonon.VideoCategory,self)
self.setStyleSheet("background-color: rgb(0, 0, 0);")
self.labelVideoSizex = QtGui.QLabel(self)
self.labelVideoSizex.setGeometry(QtCore.QRect(410, 220, 61, 31))
Here I want to change the Text Color and set the background transparend
Are you trying to incorporate this code into the videoplayer example you've created recently?
If so, could you commit the code to svn?
OK, let me try to explain what I'm doing:
Because I never written any Python code or have any experience with Qt, I have to practice.
What I'm trying to do is to write a class, we can call it e.g. "SilverScreen" or whatever, This class shall manage everything that will be visible via the projecter. In my little application it is called myvideoplayer.py (but it still need some code cleanup)
This class must have a simple interface with methods like
setScreen(self,int screen) #which monitor is used
setText(self,int xpos,ypos,QText text,QFont font)
playVideo(self, QRect rect,MediaSource mediasource)
setImage(self, QRect rect, QImage image)
something like that.
I'm just doing a "proof of concept" how you can display e.g. text on top of a movie or an image, how to display multiple images and on top of it a text or a movie, etc.
I have no idea if or how this can be realized with PyQt but I'm positiv it won't be that hard
Thanks for your work.
I also practise my knowledge of Qt and python.
This could be a good start for you:
Or you could try search something on trolltech labs:
You could download there an example:
It's a C++ example but It shouldn't be hard to customize it for PyQt.
Otherwise I would recommend you to ask in any forum specialized for qt.
If you find any useful resource or site, feel free to add the link to the wiki.
I wasn't able to get transparent background.
But I have an idea. What about trying to use classes QPainter and QPainterPath?
You could have a look at exaples what are coming with pyqt. There are some examples in the folder 'painting'.
QPainter seems to be a good solution, but I have the problem that the video is always displayed on top of the Text. Does somebody know if there is a way to change that order ?
Or might be QGLWidget a good approach for this ?
What about Phonon.VideoWidget?
you could get this object by invoking
player = Phonon.VideoPlayer()
widget = player.videoWidget()
That's just a suggestion.
Do you think it should work to create a QtGui.QDialog and add Widgets like Phonon.VideoWidget, QLabel, QPainter, etc. ? Could work ...
But how can I say which one stays on top and what item has to be in the background ? Always the last one wins ?
I don't know. It just an idea.
By calling method 'videoWidget' at your videoplayer object you can get the widget where the video is displayed.
I tried displaying QLabel at the top of that videoWidget but the effect was the same. (black background)
Anyway, you could have a look at this site, where a guy tried implementing subtitle library on top of phonon:
I don't know if his work was accepted into the 'Dragon player' but I presume that you should be able find some other information. When the library for subtitles handling was integrated into that player, the source code of that player may be a good inspiration.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.