pyqt5 qmessagebox information example

Solutions on MaxInterview for pyqt5 qmessagebox information example by the best coders in the world

showing results for - "pyqt5 qmessagebox information example"
London
23 Feb 2016
1import sys
2from PyQt4.QtGui import *
3from PyQt4.QtCore import *
4
5def window():
6   app = QApplication(sys.argv)
7   w = QWidget()
8   b = QPushButton(w)
9   b.setText("Show message!")
10
11   b.move(50,50)
12   b.clicked.connect(showdialog)
13   w.setWindowTitle("PyQt Dialog demo")
14   w.show()
15   sys.exit(app.exec_())
16	
17def showdialog():
18   msg = QMessageBox()
19   msg.setIcon(QMessageBox.Information)
20
21   msg.setText("This is a message box")
22   msg.setInformativeText("This is additional information")
23   msg.setWindowTitle("MessageBox demo")
24   msg.setDetailedText("The details are as follows:")
25   msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
26   msg.buttonClicked.connect(msgbtn)
27	
28   retval = msg.exec_()
29   print "value of pressed message box button:", retval
30	
31def msgbtn(i):
32   print "Button pressed is:",i.text()
33	
34if __name__ == '__main__': 
35   window()
Valentina
26 Sep 2018
1def open_database(self, filename=''):
2    """ This function opens a database and set this on the UI """
3 
4    # If not filename provide, then open dialog to select
5    if self.created:
6        QMessageBox.information(self,
7                                self.tr("Information"),
8                                self.tr("You may only have one database"
9                                        " open at time."))
10        DEBUG("Ya existe una base de datos abierta")
11        return
12    if not filename:
13        if self.__last_open_folder is None:
14            directory = os.path.expanduser("~")
15        else:
16            directory = self.__last_open_folder
17        filter_ = settings.SUPPORTED_FILES.split(';;')[0]
18        filename, _ = QFileDialog.getOpenFileName(self,
19                                                  self.tr("Open Database"),
20                                                  directory,
21                                                  filter_)
22        # If is canceled, return
23        if not filename:
24            return
25 
26        # Remember the folder
27        self.__last_open_folder = file_manager.get_path(filename)
28 
29    DEBUG("Abriendo la base de datos: '{}'".format(filename))
30 
31    # If filename provide
32    try:
33        # Read pdb file
34        pfile_object = pfile.File(filename)
35        db_data = pfile_object.read()
36        # Create a dict to manipulate data more easy
37        db_data = self.__sanitize_data(db_data)
38    except Exception as reason:
39        QMessageBox.information(self,
40                                self.tr("The file couldn't be open"),
41                                str(reason))
42        CRITICAL("Error al intentar abrir el archivo: {}".format(reason))
43        return
44 
45    # Create a database container widget
46    db_container = database_container.DatabaseContainer()
47 
48    try:
49        db_container.create_database(db_data)
50    except Exception as reason:
51        QMessageBox.information(self,
52                                self.tr("Error"),
53                                str(reason))
54        CRITICAL("Error al crear la base de datos: {}".format(reason))
55        return
56 
57    # Set the PFile object to the new database
58    db_container.pfile = pfile_object
59    # Add data base container to stacked
60    self.add_widget(db_container)
61    # Database name
62    db_name = file_manager.get_basename(filename)
63    # Update title with the new database name, and enable some actions
64    pireal = Pireal.get_service("pireal")
65    pireal.change_title(db_name)
66    pireal.set_enabled_db_actions(True)
67    pireal.set_enabled_relation_actions(True)
68    # Add to recent databases
69    self.recent_databases = filename
70    self.created = True
71
queries leading to this page
how to create a message box in pyqtqmessagebox information pyqt5qt for python messageboxqmessage pythonpyqt5 messageboxwhat is a qmessagebox pyqt5how to use qmessage box in pyqt4pyqt5 customize qmessageboxqmessagebox importqmessagebox pyqt5 buttonshow to use qmessagebox in pythonpyqt5 qmessagebox ok buttonshowmessage 28 29in qt pythonmessge box in pyqtshow confirmation dialog pyqtpyqt5 qmessagebox custom buttonsqmessagebox icon pyqt5pyqt qmessagebox information click connectpyqt messagebox yes nodetailedtext qmessagebox pyqt5how to use qmessagebox in python for pyside2qmessagebox pyqt5 geometrypython instakk qmesaageboxmake messagebox pyqtqmessage pyqt5pyqt message boxpyqt message box set information textdialog box in python pyqtpython qt show messageqmessage box ok or cancel 2b pyqt5confirmation dialog pyqt pyqt5 qmessagebox ok buttonpyqt5 qmessagebox question exampleqmessagebox pyqt5 pythonpyqt5 qmessagebox closepyqt messagebox basic get textpyqt5 qmessagepyqt message box set detailed textpyqt5 show message boxpyqt import qmessageboxtypes of msg boxes pyqt5q dialog box with retry and close application in pyqtpyqt5 qmessagebox buttonspyqt set message box sreizableqmessagebox pyqt5qmessagebox pyqt5 simpleshow alert pyqtpyqt messagebox connect buttonwhich module for qmessage pyqt5qt message box pythonqmessagebox standalone pyqtpyqt5 qmessagebox with text inputpyqt5 how to get the return of a qmessageboxpyqt5 qmessagebox with textmessagebox python pyqt5python qmessagebox examplepyqt5 message box warningpyqt4 message boxhtml inside qmessagebox pyqt5qmessagebox pyqt5 typesqmessagebox pyqt5 information questionpyqt5 display messageqmessagebox information pyqt5messagebox information python pyqt5qmessagebox pyqt5 questionmsgbox in pyqt5pyqt qmessagebox informationhow to create a message box in pywthow to import qmessagebox in pyqt5qmessage box show normal pyqt5pyqt5 qmessagebox documnetationqmessagebox get dialog result pyqthow to style qmessagebox in pyqt5qmessagebox from button pyqthow to use pyqt question in qmessageboxpyqt errorboxqmessagebox question pyqt 23pyqt popup messagepyqt5 qmessage boxqmessagebox pyqt6python pyqt5 qmessagebox exampleqmessageboxinside window pythonqmessagebox pyqt5 examplemessge box in pyqt5qmessagebox pythonqtpyqt5 qmessagebox iconmake message box pyqthow to use qmessagebox in pyqt4pyqt qmessageboxpyqt qmessagebox add buttonqmessagebox pyqt5 warningqmessagebox python pyqt5qmessagebox warning pyqt5 all methodsq message box with retry and close application in pyqtqmessagebox example pyqt5qmessagebox example pythonpyqt qmessagebox close itselfqmessagebox pyqt5 updateadd widget to qmessagebox pyqt5pyqt5 qmessagebox methodsqmessagebox return value pythonqmessagebox pyqtpyqt5 qmessagebox examplehow to call qmessagebox in pyqt5pyqt5 qmessagebox not workingpyqt show message boxqmessagebox samples pythonpyqt qmessagebox with a questionqmessagebox question pyqthow to get response with qmessagebox pyqt5pyqt message windowsmessage box qt pythonqmessagebox pythonqmessagebox pyqt5 alertpyqt5 qmessagebox execqmessagebox pyqt5 sizepyqt5 qmessageboxmessage box in pyqt5python pyqt5 qmessagebox aboutpyqt5 qmessagebox with buttonspyqt5 qmessagebox information examplemessagebox information in python pyqt5qmessagebox class pythonpyqt qmessagebox questionpyqt qmessagebox htmlyes or no qmessage box pyqtpyqt5 message boxpyqt5 qmessagebox with a questionhow to add message box in pyqt5qt python show alertpyqt5 qmessagebox information example