Search code examples
pythonpyqtpyqt5qlabelqmovie

Add a QLabel with fixed Position in front of a QMovie in PyQt


I am currently developing some software to show the location of tools inside a shelf.

There's a little animation in the bottom left, where the user see's the shelf opening, followed by a small legend.

At the moment, there's a second widget with the the actual data right from it

pic of my program at the moment

but i want to change it, so the data is in front of my animation

my goal

So the question is, is it possible to show a a bunch of QLabels with fixed positions in front of a QMovie? and if yes, how?


Solution

  • The basic concept is that if you want to create a widget "over" another, it has to be a child of the widget on top of which you want it to be displayed.

    Assuming that your QMovie is shown into a QLabel, as long as that label/movie have fixed and known sizes, the solution is pretty simple:

        self.overlayLabel = QtWidgets.QLabel('some text', self.qlabelShowingQMovie)
        self.overlayLabel.move(x, y)