0

I have created a QMessageBox as follows:

msg_box = QtGui.QMessageBox()
msg_box.setSizeGripEnabled(True)
msg_box.setIcon( QtGui.QMessageBox.Information )
msg_box.setText('The following files are not .jpg ')
msg_box.setInformativeText('No. of Items : {0}'.format(len(contents)))
msg_box.setDetailedText('{0}'.format('\n'.join([str(sel) for sel in img_sels])))
msg_box.setStandardButtons(QtGui.QMessageBox.Cancel)
msg_exec = msg_box.exec_()

User will select a handful of images, and if within the selections, if it consists of items that are not of jpeg/ .jpg format, these items' file path will be collated and be displayed in QMessageBox

One issue that I had is that, I am having difficulties in getting the QMessageBox to be resize or have the UI width conform according the the length or the text etc. As I am unable to do that, the popup ui displays the filepath almost like in a wrapped text format, somewhat unsightly.

Is there any other ways that I can do to improve the code and have it accommodate to the width etc? If not, is there another QtGui command that I can consider to use it?

dissidia
  • 1,531
  • 3
  • 23
  • 53
  • already replied here https://stackoverflow.com/questions/2655354/how-to-allow-resizing-of-qmessagebox-in-pyqt4 – Achayan Nov 04 '17 at 17:08
  • @AchayanThanks for the link. I am using the solution proposed by serge, and while that seems to work, is there anyway that I can set the width of the UI that are determined by the length of the string? – dissidia Nov 06 '17 at 23:27

0 Answers0