How to create icon drop down like in slicer from script?

I was able to create an icon drop-down from python-qt5 by setting the text argument to empty text. But it’s not at looking good, I want icon drop-down as it looks in slicer. How can I create it from script?

Can you provide an image of an example that you are trying to replicate? Is it a QMenu, QComboBox?

Screenshot from 2021-07-01 17-30-03

This is a question about standard Qt functionality and is not Slicer specific, but here are some details about it.

Create a QAction with an icon set to it and add it to the QMenu of a QToolButton.

1 Like