Z
Z
zaordu2021-04-04 23:04:47
PyQt
zaordu, 2021-04-04 23:04:47

How to implement array output in PYQT?

I have a window in which some info should be displayed in place of "smth" (now Qlabel hangs there), I take the data from the SQL query.
606a1b94588fe026959814.png
But I have a dilemma: now there are 3 slots on the screen for information (there will be the name of the film and its cover). What should happen is that after selecting the sorting method and pressing the sort button, the movies are displayed. And I thought that if there are more than 3, then a button will appear below to switch to the next 3 films. It turns out that every time I have to rewrite these 3 labels manually? Is it possible to automate this somehow?
It feels like this should not be done through the label at all, but there are no ideas at all.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sanya Hihi Haha, 2021-04-04
@ValarMayar

Well, for example, to generate a QLabel on the go, I'm not sure if this is a good practice, but in this case, personally, I would do this

for film in films:
       self.label = QLabel('This is label',  self)

If you are going to flip through the pages (like the next page), then you can simply update the 3 current labels when switching pages and everything
PS about "And I thought that if there are > 3, then a button will appear below to switch to the next 3 films" everyone laughed =)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question