Advertisement
MrDavidBrony

Untitled

Aug 12th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #!/usr/bin/python3
  2. # -*- coding: utf-8 -*-
  3.  
  4. import sys
  5. from PyQt5.QtWidgets import (QWidget, QToolTip, QPushButton, QMessageBox, QApplication)
  6. from PyQt5.QtGui import QFont, QFontDatabase
  7. from PyQt5.QtGui import QIcon
  8. from PyQt5 import QtGui
  9.  
  10.  
  11. class PortablePony(QWidget):
  12.  
  13. def __init__(self):
  14. super().__init__()
  15.  
  16. self.initUI()
  17.  
  18.  
  19. def initUI(self):
  20. QToolTip.setFont(QFont('SansSerif', 10))
  21.  
  22. self.setToolTip('<b>Портативная поняшка</b>')
  23.  
  24. self.resize(250, 150)
  25. self.left_bottom()
  26.  
  27. self.setWindowTitle('Портативная поняшка')
  28. self.setWindowIcon(QIcon('pinkie.png'))
  29.  
  30. self.show()
  31.  
  32. def left_bottom(self):
  33. qr = self.frameGeometry()
  34. cp = QDesktopWidget().availableGeometry().center()
  35. qr.moveCenter(cp)
  36. self.move(qr.topLeft())
  37.  
  38. def closeEvent(self, event):
  39. reply = QMessageBox.question(self, 'Message',
  40. "Закрыть Портативную поняшку?", QMessageBox.Yes |
  41. QMessageBox.No, QMessageBox.No)
  42.  
  43. if reply == QMessageBox.Yes:
  44. event.accept()
  45. else:
  46. event.ignore()
  47.  
  48.  
  49. if __name__ == '__main__':
  50.  
  51. app = QApplication(sys.argv)
  52. pony = PortablePony()
  53. sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement