Guest User

Untitled

a guest
Feb 18th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. from PyQt4 import QtGui, QtCore
  2. from PyQt4.QtCore import Qt
  3. import os
  4. ch = []
  5. class Window(QtGui.QWidget):
  6. def __init__(self, rows, columns):
  7.  
  8. QtGui.QWidget.__init__(self)
  9. self.table = QtGui.QTableWidget(rows, columns, self)
  10. self.table.move(1000,1000)
  11. layout = QtGui.QVBoxLayout(self)
  12. for row in range (rows):
  13. qwidget = QtGui.QWidget()
  14. checkbox = QtGui.QCheckBox()
  15. checkbox.setCheckState(QtCore.Qt.Unchecked)
  16. qhboxlayout = QtGui.QHBoxLayout(qwidget)
  17. qhboxlayout.addWidget(checkbox)
  18. qhboxlayout.setAlignment(Qt.AlignCenter)
  19. qhboxlayout.setContentsMargins(0, 0, 0, 0)
  20. self.table.setCellWidget(row, 0, qwidget)
  21. n =0
  22. for filename in os.listdir("C:\Python27\Codes\"):
  23. files = os.path.splitext(filename)[0]
  24. ch.append(files)
  25. self.table.setItem(n , 1, QtGui.QTableWidgetItem(str(files)))
  26. n= n+1
  27. layout.addWidget(self.table)
  28.  
  29. self.button = QtGui.QPushButton()
  30. self.button .move(1000,1000)
  31. self.button.setObjectName("loadButton")
  32.  
  33. layout.addWidget(self.button)
  34. self.button.clicked.connect(self.ButtonClicked)
Add Comment
Please, Sign In to add comment