Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. def initUI(self):
  2. names=['Cls', 'Bck', '', 'Close', '7', '8', '9', '/', '4', '5', '6', '*', '1', '2', '3', '-', '0', '.', '=', '+']
  3. grid = QGridLayout()
  4. j = 0
  5. pos = [(0,0), (0,1), (0,2), (0,3), (1,0), (1,1), (1,2), (1,3),
  6. (2,0),(2,1),(2,2),(2,3),(3,0),(3,1),(3,2),(3,3),(4,0),(4,1),(4,2),(4,3)]
  7. for i in names:
  8. button = QPushButton(i)
  9. if j == 2:
  10. grid.addWidget(QLabel(''), 0, 2)
  11. else:
  12. grid.addWidget(button, pos[j][0], pos[j][1])
  13. j = j + 1
  14. self.setLayout(grid)
  15. self.move(300, 150)
  16. self.setWindowTitle('Kalkulator')
  17. self.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement