import sys
from PyQt5.QtWidgets import *
#Main Window
class App(QWidget):
def __init__(self):
super().__init__()
# Setting the title
self.title = 'minuvaHard10 PyQt5 Table'
# Setting the Position
self.left = 0
self.top = 0
self.width = 400
self.height = 250
self.setWindowTitle(self.title)
self.setGeometry(self.left+200, self.top+200, self.width, self.height+200)
self.tableNew = QTableWidget(self)
# Giving the count for the Row
self.tableNew.setRowCount(4)
# Giving the count for the Column
self.tableNew.setColumnCount(2)
self.tableNew.setItem(0, 0, QTableWidgetItem("Banana 5u"))
self.tableNew.setItem(0, 1, QTableWidgetItem("1.55"))
self.tableNew.setItem(1, 0, QTableWidgetItem("Cucumber green"))
self.tableNew.setItem(1, 1, QTableWidgetItem("1.55"))
self.tableNew.move(20,120)
self.tableNew.resize(280, 200)
self.tableNew.setHorizontalHeaderLabels(["Producto", "Precio Uni"]) # Set the table headers
if __name__ == '__main__':
# creating the pyqt5 application
base = QApplication(sys.argv)
# creating an instance of the created Window
window = App()
# starting the application
sys.exit(base.exec_())
minuvasoft10@gmail.com - Programacion de projectos software en java netbeans, python, mysql, visual C#.
No hay comentarios:
Publicar un comentario