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

iMath 2281570025 at qq.com
Thu Feb 5 01:34:22 GMT 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://www.riverbankcomputing.com/pipermail/pyqt/attachments/20150205/90b07ae6/attachment-0001.html>


More information about the PyQt mailing list