Help to set size of widget
Unsolved
Qt for Python
-
I'm trying to set a size to the widget (PasswordEdit) with setGeometry, but not works. I'm want to the PasswordEdit stay on the center... Someone can help about this?
from PySide2.QtCore import (QCoreApplication, QDate, QDateTime, QMetaObject, QObject, QPoint, QRect, QSize, QTime, QUrl, Qt) from PySide2.QtGui import (QBrush, QColor, QConicalGradient, QCursor, QFont, QFontDatabase, QIcon, QKeySequence, QLinearGradient, QPalette, QPainter, QPixmap, QRadialGradient) from PySide2.QtWidgets import * import sys from qtwidgets import PasswordEdit class Test(QMainWindow): def __init__(self, parent=None): super().__init__(parent) self.setMinimumSize(500, 500) password = PasswordEdit() password.setGeometry(QRect(100,100,1,100)) self.setCentralWidget(password) if __name__ == '__main__': qt = QApplication(sys.argv) app = Test() app.show() qt.exec_()
-
Hi
You can use move(x,y) (and resize) instead of setGeometry
I assume that the password is not affect by any layouts as then moving it is futile :)