Skip to content
Advertisement

Creating a non-overlapping QVideoPlayer and PlotWidget in PyQt5

I am trying to create an app in PyQt5 that has a media (video) player, a graph, and a few buttons. Currently, whenever I try to add the video and graph widgets, they compete for space (lay on top of one another), even when using QGridLayout.

Here is the entire file so far. The important parts are under ‘Create video object’, ‘Create plot’, and ‘Create GUI Layout’.

Any suggestions for getting the video player to occupy the top portion of the window and the graph to occupy a region underneath?

JavaScript

Advertisement

Answer

The problem is that the QVideoWidget at startup does not have to display anything so the sizeHint is (-1x-1) making it occupy the smallest possible size causing the problem you are seeing.

A possible solution is to establish the same stretching factor between rows 0 and 1, it is not necessary nor should you place the proportions in the span, considering the above the solution is:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement