Skip to content Skip to sidebar Skip to footer

How To Make A Variable-column Grid Using Pyqt

I'm trying to display an array of image thumbnails using Python and Qt4. My problem is that I don't want to calculate the amount of columns for the grid, so that when the applicati

Solution 1:

Brendan Abel's answer is the right and elegant way to use the power of Qt. However, if you find model-view architecture too heavy, I'd suggest you to use FlowLayout demonstrated in here.

Its rather quite easy to implement and may suit your needs.

Solution 2:

You should look into using a QGraphicsView. It's a good building block for truly custom widgets that don't really resemble any of the built-in widgets. It uses a model/view architecture and allows you pretty much unlimited flexibility how and where each item is drawn, as opposed to relying on the more limited QLayout system of placement.

Post a Comment for "How To Make A Variable-column Grid Using Pyqt"