Skip to content
Advertisement

how to do a pagination bar in PyQT?

I need to paginate data from SQL tables.

I cant find any information about pagination in PyQT or Pyside. Can you help me pls?

like this

Advertisement

Answer

One way to handle pagination is to use the QStackedWidget for emulating the pages themselves, and regular QLabels as the page links. Then you can override each labels mousePressEvent to emit a signal to the stacked widget to set the current index to the page number from the label that was clicked.

Here is Minimal Reproducible Example using PySide6 that demonstrates the suggested strategy.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement