PyQt - multiple window instances?

gregarican greg.kujawa at gmail.com
Fri Feb 24 14:16:38 EST 2006


I have an PyQt app were I need one of the windows to be able to be
opened more than one at a time. When I try to open it I only get one
instance at the same time. The main class is the QWidget() class with a
QGridLayout() displaying the various window components.

Is there a certain flag I need to set or different constructor I need
to use to allow the window to be opened more than one at a time?

Here's a brief snippet of the code that displays the window:

def new_showing(self):
        """ This method creates a new contact showing record. """

        if self.flag == 'KNOWN':
            try:
                test_contact = self.entry_id
            except:
                QMessageBox.warning(self, "Qt CRAM", "There is no
contact record loaded.\nPlease select a contact record first.")
                return

        self.new_show_widget=QWidget()
        self.new_show_widget.resize(240, 280)
        self.new_show_widget.setCaption('Qt CRAM - Contact Showings')

        # Define the Qt layout to be used for the window.
        self.new_show_grid=QGridLayout(self.new_show_widget, 8, 2)

        # bunch of widgets displaying stuff

        self.new_show_widget.show()




More information about the Python-list mailing list