Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt4 import QtGui, QtCore
- from PyQt4.QtCore import Qt
- import os
- ch = []
- class Window(QtGui.QWidget):
- def __init__(self, rows, columns):
- QtGui.QWidget.__init__(self)
- self.table = QtGui.QTableWidget(rows, columns, self)
- self.table.move(1000,1000)
- layout = QtGui.QVBoxLayout(self)
- for row in range (rows):
- qwidget = QtGui.QWidget()
- checkbox = QtGui.QCheckBox()
- checkbox.setCheckState(QtCore.Qt.Unchecked)
- qhboxlayout = QtGui.QHBoxLayout(qwidget)
- qhboxlayout.addWidget(checkbox)
- qhboxlayout.setAlignment(Qt.AlignCenter)
- qhboxlayout.setContentsMargins(0, 0, 0, 0)
- self.table.setCellWidget(row, 0, qwidget)
- n =0
- for filename in os.listdir("C:\Python27\Codes\"):
- files = os.path.splitext(filename)[0]
- ch.append(files)
- self.table.setItem(n , 1, QtGui.QTableWidgetItem(str(files)))
- n= n+1
- layout.addWidget(self.table)
- self.button = QtGui.QPushButton()
- self.button .move(1000,1000)
- self.button.setObjectName("loadButton")
- layout.addWidget(self.button)
- self.button.clicked.connect(self.ButtonClicked)
Add Comment
Please, Sign In to add comment