當前位置: 首頁>>代碼示例>>Python>>正文


Python QtGui.QMessageBox方法代碼示例

本文整理匯總了Python中PyQt4.QtGui.QMessageBox方法的典型用法代碼示例。如果您正苦於以下問題:Python QtGui.QMessageBox方法的具體用法?Python QtGui.QMessageBox怎麽用?Python QtGui.QMessageBox使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt4.QtGui的用法示例。


在下文中一共展示了QtGui.QMessageBox方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: insertImage

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def insertImage(self):

        # Get image file name
        filename = QtGui.QFileDialog.getOpenFileName(self, 'Insert image',".","Images (*.png *.xpm *.jpg *.bmp *.gif)")

        if filename:

            # Create image object
            image = QtGui.QImage(filename)

            # Error if unloadable
            if image.isNull():

                popup = QtGui.QMessageBox(QtGui.QMessageBox.Critical,
                                          "Image load error",
                                          "Could not load image file!",
                                          QtGui.QMessageBox.Ok,
                                          self)
                popup.show()

            else:

                cursor = self.text.textCursor()

                cursor.insertImage(image,filename) 
開發者ID:goldsborough,項目名稱:Writer,代碼行數:27,代碼來源:writer.py

示例2: threadDone

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def threadDone(self):
        """
        Callback for thread end.
        """

        del self.thread
        self.thread = None
        self.mytimer.stop();
        self.singleProgress.setValue(100)
        #Display result in tab
        self.display_result_in_tab()
        self.progressDialog.hide();
        #self.display_result_in_tab()
        QtGui.QApplication.restoreOverrideCursor()
        RightToLeft=1;
        msgBox=QtGui.QMessageBox(self.centralwidget);
        msgBox.setWindowTitle(QtGui.QApplication.translate("MainWindow", "مشكال", None, QtGui.QApplication.UnicodeUTF8));
        msgBox.setText(u"انتهى التشكيل");
        msgBox.setLayoutDirection(RightToLeft);
        msgBox.setStandardButtons(QtGui.QMessageBox.Ok);
        msgBox.setDefaultButton(QtGui.QMessageBox.Ok);
        msgBox.exec_(); 
開發者ID:linuxscout,項目名稱:mishkal,代碼行數:24,代碼來源:appgui.py

示例3: whoisqutrub

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def whoisqutrub(self):
        RightToLeft=1;
        msgBox=QtGui.QMessageBox(self.centralwidget);
        msgBox.setWindowTitle(u"عن البرنامج");	
        data=QtCore.QFile("ar/projects.html");
        if (data.open(QtCore.QFile.ReadOnly)):
            textstream=QtCore.QTextStream(data);
            textstream.setCodec("UTF-8");
            text=textstream.readAll();
        else:
            text=u"لا يمكن فتح ملف المساعدة"


        msgBox.setText(text);
        msgBox.setLayoutDirection(RightToLeft);
        msgBox.setStandardButtons(QtGui.QMessageBox.Ok);
        msgBox.setDefaultButton(QtGui.QMessageBox.Ok);
        msgBox.exec_(); 
開發者ID:linuxscout,項目名稱:mishkal,代碼行數:20,代碼來源:appgui.py

示例4: about

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def about(self):
        RightToLeft=1;
        msgBox=QtGui.QMessageBox(self.centralwidget);
        msgBox.setWindowTitle(u"عن البرنامج");
##          msgBox.setTextFormat(QrCore.QRichText);

        data=QtCore.QFile("ar/about.html");
        if (data.open(QtCore.QFile.ReadOnly)):
            textstream=QtCore.QTextStream(data);
            textstream.setCodec("UTF-8");
            text_about=textstream.readAll();
        else:
#            text=u"لا يمكن فتح ملف المساعدة"
            text_about=u"""<h1>فكرة</h1>

"""
        msgBox.setText(text_about);
        msgBox.setLayoutDirection(RightToLeft);
        msgBox.setStandardButtons(QtGui.QMessageBox.Ok);
        msgBox.setIconPixmap(QtGui.QPixmap(os.path.join(PWD, "ar/images/logo.png")));
        msgBox.setDefaultButton(QtGui.QMessageBox.Ok);
        msgBox.exec_(); 
開發者ID:linuxscout,項目名稱:mishkal,代碼行數:24,代碼來源:appgui.py

示例5: show_about

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def show_about(self):
        """
            Shows the about dialog.
        """

        msg = u"""Um gerador de certificados para cursos livres e eventos feito em Python para gerar certificados em PDF e, inclusive, enviá-los por e-mail. É só cadastrar seu evento e logo em seguida seus participantes e, voilà, certificados emitidos!\n\nMais informações em: https://github.com/juliarizza/certificate_generator
        """

        about = QtGui.QMessageBox()
        about.setGeometry(450, 300, 200, 200)
        about.setIcon(QtGui.QMessageBox.Information)
        about.setText(u"Sobre o Certifica!")
        about.setInformativeText(msg)
        about.setWindowTitle(u"Sobre o Certifica!")
        about.setStandardButtons(QtGui.QMessageBox.Ok)
        about.exec_() 
開發者ID:juliarizza,項目名稱:certificate_generator,代碼行數:18,代碼來源:app.py

示例6: done

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def done(self):
        """
            Shows up a message box informing that
            the task is completed.
        """

        # Setup the message box
        self.message = QtGui.QMessageBox()
        self.message.setGeometry(450, 300, 300, 200)
        self.message.setIcon(QtGui.QMessageBox.Information)
        self.message.setWindowTitle(u"Pronto!")
        self.message.setStandardButtons(QtGui.QMessageBox.Ok)
        if not self.preview:
            self.message.setText(u"Todos os certificados foram gerados!")
        else:
            self.message.setText(u"O certificado foi gerado com "
                                 u"o nome PREVIEWDECLIENTE.pdf")

        # Shows up the message box
        self.message.exec_()

        # Hide the dialog
        self.hide() 
開發者ID:juliarizza,項目名稱:certificate_generator,代碼行數:25,代碼來源:certificates.py

示例7: insertImage

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def insertImage(self):

        # Get image file name
        filename = QtGui.QFileDialog.getOpenFileName(self, 'Insert image',".","Images (*.png *.xpm *.jpg *.bmp *.gif)")

        if filename:
            
            # Create image object
            image = QtGui.QImage(filename)

            # Error if unloadable
            if image.isNull():

                popup = QtGui.QMessageBox(QtGui.QMessageBox.Critical,
                                          "Image load error",
                                          "Could not load image file!",
                                          QtGui.QMessageBox.Ok,
                                          self)
                popup.show()

            else:

                cursor = self.text.textCursor()

                cursor.insertImage(image,filename) 
開發者ID:goldsborough,項目名稱:Writer-Tutorial,代碼行數:27,代碼來源:part-3.py

示例8: zipdb

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def zipdb(self):
        filename_tuple = widgets.QFileDialog.getSaveFileName(self, _("Save database (keep '.zip' extension)"),
                                                   "./ecu.zip", "*.zip")
        if qt5:
            filename = str(filename_tuple[0])
        else:
            filename = str(filename_tuple)
        
        if not filename.endswith(".zip"):
            filename += ".zip"

        if not isWritable(str(os.path.dirname(filename))):
            mbox = widgets.QMessageBox()
            mbox.setText("Cannot write to directory " + os.path.dirname(filename))
            mbox.exec_()
            return

        self.logview.append(_("Zipping XML database... (this can take a few minutes"))
        core.QCoreApplication.processEvents()
        parameters.zipConvertXML(filename)
        self.logview.append(_("Zip job finished")) 
開發者ID:cedricp,項目名稱:ddt4all,代碼行數:23,代碼來源:ddt4all.py

示例9: remove_selected

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def remove_selected(self):
        if len(self.datatable.selectedItems()) == 0:
            return

        r = self.datatable.selectedItems()[-1].row()
        dataname = utf8(self.datatable.item(r, 0).text())

        # Check if data needed by request
        for reqname, request in self.ecurequestsparser.requests.iteritems():
            for rcvname, rcvdi in request.dataitems.iteritems():
                if rcvname == dataname:
                    msgbox = widgets.QMessageBox()
                    msgbox.setText(_("Data is used by request %s") % reqname)
                    msgbox.exec_()
                    return
            for sndname, snddi in request.sendbyte_dataitems.iteritems():
                if sndname == dataname:
                    msgbox = widgets.QMessageBox()
                    msgbox.setText(_("Data is used by request %s") % reqname)
                    msgbox.exec_()
                    return

        self.ecurequestsparser.data.pop(dataname)

        self.reload() 
開發者ID:cedricp,項目名稱:ddt4all,代碼行數:27,代碼來源:dataeditor.py

示例10: handleButton

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def handleButton(self):
        url = str(self.ui.videoUrlLineEdit.text())
        if url is '':
            QtGui.QMessageBox.information(self, "Error!","No url given!")
            return
        can_download, rowcount = self.can_download(url)
        if can_download:
            self.download_url(url, rowcount)
        else:
            QtGui.QMessageBox.information(self, "Error!","This url is already being downloaded")
            if len(self.url_list) is not 0:
                if len(self.url_list) < 2:
                    self.ui.statusbar.showMessage('Downloading {0} file'.format(len(self.url_list)))
                else:
                    self.ui.statusbar.showMessage('Downloading {0} files'.format(len(self.url_list)))
            else:
                self.ui.statusbar.showMessage("done") 
開發者ID:yasoob,項目名稱:youtube-dl-GUI,代碼行數:19,代碼來源:main.py

示例11: quickMsg

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def quickMsg(self, msg, block=1):
        tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
        tmpMsg.setWindowTitle("Info")
        lineCnt = len(msg.split('\n'))
        if lineCnt > 25:
            scroll = QtWidgets.QScrollArea()
            scroll.setWidgetResizable(1)
            content = QtWidgets.QWidget()
            scroll.setWidget(content)
            layout = QtWidgets.QVBoxLayout(content)
            tmpLabel = QtWidgets.QLabel(msg)
            tmpLabel.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse)
            layout.addWidget(tmpLabel)
            tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
            tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
        else:
            tmpMsg.setText(msg)
        if block == 0:
            tmpMsg.setWindowModality( QtCore.Qt.NonModal )
        tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
        if block:
            tmpMsg.exec_()
        else:
            tmpMsg.show() 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:26,代碼來源:universal_tool_template_1115.py

示例12: quickMsg

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def quickMsg(self, msg, block=1):
        tmpMsg = QtWidgets.QMessageBox(self) # for simple msg that no need for translation
        tmpMsg.setWindowTitle("Info")
        lineCnt = len(msg.split('\n'))
        if lineCnt > 25:
            scroll = QtWidgets.QScrollArea()
            scroll.setWidgetResizable(1)
            content = QtWidgets.QWidget()
            scroll.setWidget(content)
            layout = QtWidgets.QVBoxLayout(content)
            layout.addWidget(QtWidgets.QLabel(msg))
            tmpMsg.layout().addWidget(scroll, 0, 0, 1, tmpMsg.layout().columnCount())
            tmpMsg.setStyleSheet("QScrollArea{min-width:600 px; min-height: 400px}")
        else:
            tmpMsg.setText(msg)
        if block == 0:
            tmpMsg.setWindowModality( QtCore.Qt.NonModal )
        tmpMsg.addButton("OK",QtWidgets.QMessageBox.YesRole)
        if block:
            tmpMsg.exec_()
        else:
            tmpMsg.show() 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:24,代碼來源:universal_tool_template_1112.py

示例13: DrawButton_clicked

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def DrawButton_clicked(self):
       if self.projectopen:
           # ConvertCSV to JSON
           with open(self.classdatafilecsv) as f:
               reader = csv.DictReader(f)
               rows = list(reader)
           with open(self.classdatafilejson, 'w') as f:
               json.dump(rows, f)
           self.drawcsv=False
           self.DrawButtonSingleCSV_clicked()
       else:
           msg=QtGui.QMessageBox()
           msg.setText("Please, open a Project first")
           ret=msg.exec()

       self.listWidgetRemoteOutput.addItem("Finished!")
       QtGui.QApplication.processEvents() 
開發者ID:ElevenPaths,項目名稱:HiddenNetworks-Python,代碼行數:19,代碼來源:HiddenNetworks.py

示例14: close_app

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def close_app(self):
		#choice = QtGui.QMessageBox.question(self,"Exit","Are you sure you want to quit?",QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
		choice = QtGui.QMessageBox()
		choice.setText('Are you sure you want to quit?')
		#choice = QtGui.QMessageBox.question(self,"Exit","Are you sure you want to quit?")
		a=QtGui.QPushButton('Yes')
		a.setStyleSheet("background-color: orange;border-radius: 15px; border-color: orange;padding: 20px; border-top: 10px transparent;border-bottom: 10px transparent;border-right: 10px transparent;border-left: 10px transparent;");
		choice.addButton(a, QtGui.QMessageBox.YesRole)
		b=QtGui.QPushButton('No')
		b.setStyleSheet("background-color: orange;border-radius: 15px; border-color: orange;padding: 20px; border-top: 10px transparent;border-bottom: 10px transparent;border-right: 10px transparent;border-left: 10px transparent;");
		choice.addButton(b, QtGui.QMessageBox.NoRole)
		choice.setStyleSheet("background-color: rgb(189,189,189);""font:Comic Sans MS")
		ret = choice.exec_()

		if QtGui.QMessageBox.Yes:
			print("Program Quit!!")
			sys.exit()
		else:
			pass
			#print "This is the end"
			#sys.exit() 
開發者ID:ishita27,項目名稱:Printed-Text-recognition-and-conversion,代碼行數:23,代碼來源:gui.py

示例15: extract_message

# 需要導入模塊: from PyQt4 import QtGui [as 別名]
# 或者: from PyQt4.QtGui import QMessageBox [as 別名]
def extract_message(self):
		perform_ocr("original_img.jpg")
		print (self.boundary_xy)
		msg = QMessageBox()
		msg.setIcon(QMessageBox.Information)
		msg.setText("Text file saved")
		msg.setWindowTitle("Information")
		#msg.setStandardButtons(QMessageBox.Ok)
		a=QtGui.QPushButton('Ok')
		a.setStyleSheet("background-color: orange;border-radius: 15px; border-color: orange;padding-left: 20px;padding-right: 20px;padding-top: 10px;padding-bottom: 10px; border-top: 10px transparent;border-bottom: 10px transparent;border-right: 10px transparent;border-left: 20px transparent;");
		msg.addButton(a,QtGui.QMessageBox.YesRole)
		msg.setStyleSheet("background-color: rgb(189,189,189);")
		#msg.buttonClicked.connect(msgbtn)
		retval = msg.exec_()
		self.extract_complete_signal.emit()
		#os.startfile("output.txt")
		#w = QWidget()
		#QMessageBox.information(w, "Message", "Text file saved ") 
開發者ID:ishita27,項目名稱:Printed-Text-recognition-and-conversion,代碼行數:20,代碼來源:gui.py


注:本文中的PyQt4.QtGui.QMessageBox方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。