<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 6 Mar 2020, at 07:25, Souvik Dutta Chowdhury <<a href="mailto:souvik.viksou@outlook.com" class="">souvik.viksou@outlook.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div dir="auto" class="">I have a vbox layout which is my main layout. I have set a label to be the sole widget in my layout. I have not specified anything else except <div dir="auto" class="">self.vbox.addWidget(label)</div></div></div></blockquote><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div dir="auto" class="">The problem is when the window is first run the label appears at the top most corner but then changes position to the middle of the page. </div></div></div></blockquote><div><br class=""></div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">QVBoxLayout is documented here <a href="https://doc.qt.io/qt-5/qvboxlayout.html" class="">https://doc.qt.io/qt-5/qvboxlayout.html</a> says its a derived from</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">QBoxLayout <a href="https://doc.qt.io/qt-5/qboxlayout.html" class="">https://doc.qt.io/qt-5/qboxlayout.html</a> where the addWidget() call is documented.</div><div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">addWidget has an alignment arg, I think that is what you are looking for.</div><div class=""><br class=""></div><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div dir="auto" class="">The change happens when I try to resize the window. Why is this happening and how to stop it?</div></div></div></blockquote><div><br class=""></div><div>The layouts cause the contained widgets to resize when the layout is resized. This is usually what you want.</div><div>If you really want to change the way resize works then override the resize (?) method on the widget.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div dir="auto" class=""> I even tried using a</div><div dir="auto" class="">label.setGeometry(10, 10, 200, 200)</div></div></div></blockquote><div><br class=""></div><div>This is changed when the resize happens.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div dir="auto" class="">The result is still the same.</div></div></div></blockquote><div><br class=""></div><div>Barry</div><div><br class=""></div></div></body></html>