当前位置: 首页>>代码示例>>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;未经允许,请勿转载。