[PyQt] multiple dialog boxes simultaneously
dougb at bellz.org
Mon Dec 3 11:57:55 GMT 2007
Pradnyesh Sawant wrote:
> Thanks for replying; coz this problem has been bugging me for quite some
> time now...
> On 06:17, 30 Nov, Doug Bell wrote:
> > Pradnyesh Sawant wrote:
> > Since you aren't keeping a refernce to QTimer or giving it an explicit Qt
> > parent, it's probably getting garbage collected. Try replacing tmr with
> > self.tmr.
> I'll try that
> > > The other doubt is that only the last created dialog box can have focus.
> > > How do I make it possible to give all dialog boxes the focus?
> > That doesn't make sense to me. Focus means that keyboard entries will go to
> > the focused widget. Do you want the same keyboard input to go to all of the
> > to work around the normal behavior.
> I probably used the wrong terminology. What I really meant was that in the
> current situation, only the last created dialog box has it's widgets
> usable. All the other dialog boxes are greyed out, I mean even if click the
> mouse on the dialog, it's widgets are still not useable. I think sdi/mdi is
> the correct terminology for what I want, but I'm not sure I understand what
> they actually mean.
> Or, probably, what I mean is that the newly created dialog is a child of
> the orignal one (now the parent), and the parent is not accessible till the
> child has been closed. How do I make it possible for both the child and
> parent to be accessible at the same time?
The terminology for what you want is modal vs. modeless dialogs.
Basically, modal dialogs are blocking, waiting for user input. What you
want is modeless. See the QDialog docs for more info.
To get modeless, you need to call show(), not exec_(). It appears from
your code that the first dialog has an exec_(). You should be calling
app.exec_() initially, but show() your dialogs.
You also seem to be calling show() on the previous dialog only after the
timer fires and you're creating the next one. It would make more sense
to call show() as soon as each dialog is created.
More information about the PyQt