[PyQt] Text and Image Alignment

uahmed gleam.uahmed at gmail.com
Tue Aug 16 23:20:03 BST 2011


HI

I want to do alignment in  image and text , i want that image should be on
center top and text should be at the bottom of image . I search for it but
didnt get the  relevant search result . Can you please tell me how to do
that ?

Chunk of Code for Button Without Text:

                button = QtGui.QPushButton(widget)
                button.setIcon(QtGui.QIcon('default.gif'))
                button.setIconSize(QtCore.QSize(100,100))
                button.setGeometry(xval,yval, 130, 130)
                button.connect(button, QtCore.SIGNAL('clicked()'),
partial(calluser, user_Handle))

Chunk of Code for Button With Text:

                button = QtGui.QPushButton(widget)
                button.setIcon(QtGui.QIcon('default.gif'))
                button.setIconSize(QtCore.QSize(100,100))
                button[text].setText(QtCore.QString(user_Handle))
                button.setGeometry(xval,yval, 130, 130)
                button.connect(button, QtCore.SIGNAL('clicked()'),
partial(calluser, user_Handle))

Thank You

Ahmed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110817/812dda03/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image-text-allignment.gif
Type: image/gif
Size: 11158 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20110817/812dda03/attachment.gif>


More information about the PyQt mailing list