I've been trying to stay up to date on emails I've received for bugs that have popped up with PiP, I wanted to cover one of the bugs. The interactive tutorial included with PiP is displayed on the bottom of the PiP instance widget in a green bar with a QLabel widget. I noticed even after the completion of the tutorial that interacting with the resize button would sometimes cause the green bar to turn back on...
PiP tutorial QLabel widget with css style |
1 2 3 | # update tutorial label to resize to window self.main_class.label.setFixedSize( QtCore.QSize( new_width, self.main_class.label.height() ) ) self.main_class.label.move( 0, self.parent().height() - self.main_class.label.height() ) |
Here is the fix...
1 2 3 4 5 | # update tutorial label to resize to window if self.main_class.label.width() > 1: self.main_class.label.setFixedSize( QtCore.QSize( new_width, self.main_class.label.height() ) ) self.main_class.label.move( 0, self.parent().height() - self.main_class.label.height() ) |
So it was just a simple if statement with comparing the use of the tutorial widget. My green tutorial bar is just a simple QLabel with a green style sheet background applied to it, when the tutorial is active it should automatically resize with the window. In an instance when it is NOT active - such as after the tutorial is completed - it should go away (width value of 0). So a simple check of a valid width will suffice in determining if we want to update the width along with the window resize changes.