1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
   | from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import sys
 
class Main(QWidget):
	def __init__(self, *args, **kwargs):
		QWidget.__init__(self, *args, **kwargs)
		layout  = QGridLayout(self)
		layout.addWidget(Table(3, 2, parent=self), 0, 0, 1, 1)		# Ligne 0, colonne 0, 1 ligne, 1 colonne
		layout.addWidget(QTextEdit(parent=self), 0, 1, 1, 1)		# Ligne 0, colonne 1, 1 ligne, 1 colonne
		layout.addWidget(QTextEdit(parent=self), 1, 0, 1, 2)		# Ligne 1, colonne 0, 1 ligne, 2 colonnes
		self.show()
	# __init__()
# class Main
 
class Table(QTableWidget):
	def __init__(self, rows, cols, *args, **kwargs):
		super().__init__(rows, cols, *args, **kwargs)
 
	def mousePressEvent(self, event):
		print(event.pos())
# class Table
 
a = QApplication(sys.argv)
m = Main()
sys.exit(a.exec_())  | 
Partager