2

I am working with PySide on the Raspberry PI + PiTFT, making a kiosk style (ie, fullscreen) style app.

I'm restricted to 320x240 pixels - and having a very hard time forcing message boxes to a specifc size.

Ultimately, I am wanting to make a fullscreen, on-top message box / dialog.

I've considered using the code: How to allow resizing of QMessageBox in PyQt4 But this hooks on every event, and paints artefacts on the screen.

What is the best / better way to creating on-top, full screen messageboxes ?

Community
  • 1
  • 1
swx
  • 65
  • 8

2 Answers2

0

There are a lot of suggestions out there for resizing QMessageBox's and I tried most of them - for me they didn't work. What did work was to get a handle on the underlying QGridLayout and set the minimum sizes there.

class myMsgBox(QtGui.QMessageBox):
    def __init__(self, parent):
        self.findChild(QtGui.QGridLayout).setColumnMinimumWidth(1, 700)
        ...
BrandonB
  • 1
  • 1
0

Try this:

def messageBox(msg, text, informtext): msg.setText(text) msg.setInformativeText(informtext) msg.findChild(QGridLayout).setColumnMinimumWidth(1, len(msg.informativeText()) * msg.fontMetrics().averageCharWidth()) msg.exec()

Reza
  • 21
  • 3