Add pop up tutorial
This commit is contained in:
parent
a4f7d5bbc5
commit
5ca4d0083c
@ -9,7 +9,7 @@
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
@ -32,11 +32,34 @@ class Ui_MainWindow(object):
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
self.button.clicked.connect(self.show_popup)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
self.button.setText(_translate("MainWindow", "Pop goes my hearth !"))
|
||||
|
||||
def show_popup(self):
|
||||
msg = QMessageBox()
|
||||
msg.setWindowTitle("Tutorial on PyQt5")
|
||||
msg.setText("This is the main text !")
|
||||
msg.setInformativeText("Informative text.")
|
||||
|
||||
#msg.setIcon(QMessageBox.Critical)
|
||||
#msg.setIcon(QMessageBox.Warning)
|
||||
msg.setIcon(QMessageBox.Information)
|
||||
#msg.setIcon(QMessageBox.Question)
|
||||
|
||||
msg.setStandardButtons(QMessageBox.Cancel|QMessageBox.Retry|QMessageBox.Ignore)
|
||||
msg.setDefaultButton(QMessageBox.Ignore)
|
||||
|
||||
msg.setDetailedText("Details")
|
||||
|
||||
msg.buttonClicked.connect(self.popup_button)
|
||||
x = msg.exec_()
|
||||
|
||||
def popup_button(self, ii):
|
||||
print(ii.text())
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
Loading…
Reference in New Issue
Block a user