D
D
DanyGrishaev2016-03-18 18:36:58
Python
DanyGrishaev, 2016-03-18 18:36:58

Pyqt. How to properly center and resize?

I have MainWindow. setCenterWidget() has a label. in the label image.
Question with positioning and resizing.
I decided to make the minimum size of MainWindow. And for the label, make some maximum, so that there is some space on the sides. Well and therefore it is necessary to reduce the size of the image without losing proportions. In addition, it is necessary that the size change proportionally, due to the fact that the user will change the size with his handles.
+ you need to make the label in the center. I understand that if I put it alone in the center, then image will add space and nothing will work out. Therefore, it seems that the image should also be centered.
I did like this (all the code, but I didn't finish it): https://gist.github.com/GriDanny/15047a2ea7707567960b
# in line 68 is nonsense, there was an overload of methods, but it did not work out with this
# from line 79 a method begins that centers
I'm only doing centering so far.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zaswed, 2016-03-18
@zaswed

why not use layout managers.
and QLabel has methods - setScaledContents and setAlignment
if I understand correctly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question