• PyQt5 控件大小


    ################################
    # PyQt5中文网 - PyQt5全套视频教程 #
    #    https://www.PyQt5.cn/     #
    #         主讲: 村长            #
    ################################
    
    from PyQt5.Qt import *
    import sys
    
    
    class Window(QWidget):
        def __init__(self):
            super().__init__()
            self.setWindowTitle("获取和设置控件尺寸、大小以及控件大小尺寸限定")
            # self.resize(600,500)
            self.func_list()
    
        def func_list(self):
            self.func()
    
        def func(self):
            label = QLabel(self)
            # label.resize(60, 30)
            # label.move(50, 200)
            label.setGeometry(50, 200, 60, 30)
            label.setText('标')
            # label.adjustSize()
            label.setFixedSize(52, 50)
    
            label.setStyleSheet('background-color:green')
    
            label.setContentsMargins(50, 0, 0, 0)
            print(label.getContentsMargins())
            print(label.contentsRect())
    
    
    if __name__ == '__main__':
        app = QApplication(sys.argv)
        window = Window()
    
        window.setMinimumSize(200, 200)
        window.setMaximumSize(500, 600)
        print(window.maximumHeight())
    
        window.show()
        sys.exit(app.exec_())
    

      

  • 相关阅读:
    Eighth scrum meeting
    Seventh scrum meeting
    Sixth scrum meeting
    Fifth scrum meeting
    Forth scrum meeting
    Third scrum meeting
    2019-07-25 L430 生物 GPS
    L429 Why Do Smart People Do Foolish Things?
    L427 长难句
    L426
  • 原文地址:https://www.cnblogs.com/lvdongjie/p/16331071.html
Copyright © 2020-2023  润新知