[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] VBoxLayout help.
From: Barry Scott <barry () barrys-emacs ! org>
Date: 2020-03-06 8:51:28
Message-ID: 95BC08D7-A071-4E99-BF5A-D6C176D8AB58 () barrys-emacs ! org
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
> On 6 Mar 2020, at 07:25, Souvik Dutta Chowdhury <souvik.viksou@outlook.com> wrote:
>
> 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 \
> self.vbox.addWidget(label)
> 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.
QVBoxLayout is documented here https://doc.qt.io/qt-5/qvboxlayout.html \
<https://doc.qt.io/qt-5/qvboxlayout.html> says its a derived from QBoxLayout \
https://doc.qt.io/qt-5/qboxlayout.html <https://doc.qt.io/qt-5/qboxlayout.html> where \
the addWidget() call is documented. addWidget has an alignment arg, I think that is \
what you are looking for.
> The change happens when I try to resize the window. Why is this happening and how \
> to stop it?
The layouts cause the contained widgets to resize when the layout is resized. This is \
usually what you want. If you really want to change the way resize works then \
override the resize (?) method on the widget.
> I even tried using a
> label.setGeometry(10, 10, 200, 200)
This is changed when the resize happens.
> The result is still the same.
Barry
[Attachment #5 (unknown)]
<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>
[Attachment #6 (text/plain)]
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic