zoukankan      html  css  js  c++  java
  • PyQt5--GridLayout

     1 # -*- coding:utf-8 -*-
     2 '''
     3 Created on Sep 13, 2018
     4 
     5 @author: SaShuangYiBing
     6 '''
     7 import sys
     8 from PyQt5.QtWidgets import QApplication,QWidget,QPushButton,QGridLayout
     9 
    10 class New_test(QWidget):
    11     def __init__(self):
    12         super().__init__()
    13         self.initUI()
    14         
    15     def initUI(self):
    16         grid = QGridLayout()
    17         self.setLayout(grid)
    18         
    19         names = ['Cls','Bck','','Close','7','8','9','/','4','5','6','*','1','2','3','-','0','.','=','+']
    20         
    21         positions = [(i,j) for i in range(5) for j in range(4)]
    22         
    23         print (list(zip(positions,names)))
    24         
    25         for position,name in zip(positions,names):
    26             if name == '':
    27                 continue
    28             button = QPushButton(name)
    29             grid.addWidget(button,*position)
    30         
    31         self.move(300,150)
    32         self.setWindowTitle('Calculator')
    33         self.show()
    34         
    35 if __name__ == "__main__":
    36     app = QApplication(sys.argv)
    37     ex = New_test()
    38     sys.exit(app.exec_())              
    39             

  • 相关阅读:
    [BJOI2019]排兵布阵
    关于DP题的状态定义转换和各种优化这档事
    容斥原理学习笔记
    莫比乌斯反演学习笔记
    每日进度
    每日进度
    每日进度
    每日进度
    每日进度
    每日进度
  • 原文地址:https://www.cnblogs.com/aziji/p/9641955.html
Copyright © 2011-2022 走看看