PyQt6 Tutorials
About Lesson

In this PyQt6 lesson we are going to learn about How to Create QTableWidget with PyQt6, using QTableWidge we can add items in row and columns. we will learn how you can use coding for creating QTableWidget and how you can use Qt Designer.

 

 

This is the complete code for this lesson.

 

 

In here we have created our QTableWidget object also we need to set the row and column count for the tablewidget.

 

 

 

And using QTableWidgeItem class you can add items to the pyqt tablewidget, you need to set the row and column for the items.

 

 

 

Run the complete code and this is the result.

How to Create QTableWidget with PyQt6
How to Create QTableWidget with PyQt6

 

 

 

Now we want to use Qt Designer for creating QTableWidget, we can just write pyqt5designer in our terminal, after opening the Qt Designer we need to create Widgets window. now we add widgets in Qt Designer.

  • Add a Vertical Layout in the Qt Designer 
  • Add a TableWidget item in the VBoxLayout 
  • Right click and add items in the column and rows 
PyQt6 QTableWidget Qt Designer
PyQt6 QTableWidget Qt Designer

 

 

 

Now convert your UI file to Py file using this command.

 

 

This is the converted file.

 

 

 

Run the complete code and this is the result.

How to Create QTableWidget with PyQt6
How to Create QTableWidget with PyQt6