[PySide] move QMessageBox to bottom-right corner of the screen

iMath 2281570025 at qq.com
Sun Feb 8 12:49:42 CET 2015


I want to move QMessageBox to bottom-right corner of the screen, following is my code,but doesn't work as expected , anyone can explain why? How to fix the problem here ?‍


import sys from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * def moveToBottomRight(msgBox):     msgBox.addButton("重计", QMessageBox.ActionRole)     msgBox.addButton("停计", QMessageBox.ActionRole)     msgBox.addButton('继续', QMessageBox.ActionRole)     screenGeometry = QApplication.desktop().availableGeometry()     screenGeo = screenGeometry.bottomRight()     msgGeo = msgBox.frameGeometry()     msgGeo.moveBottomRight(screenGeo)     msgBox.move(msgGeo.topLeft()) def main():     app = QApplication(sys.argv)     msgBox = QMessageBox()     moveToBottomRight(msgBox)     msgBox.show()     sys.exit(app.exec_()) if __name__ == '__main__':     main()‍
Question also posted here http://stackoverflow.com/questions/28322073/move-qmessagebox-to-bottom-right-corner-of-the-screen#28323459‍
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20150208/1ca5c747/attachment.html>


More information about the PySide mailing list