[PyKDE] More QWidget queries.

Andreas Pakulat apaku at gmx.de
Wed Sep 13 23:17:06 BST 2006


On 13.09.06 23:06:33, Dave S wrote:
> On Wednesday 13 September 2006 22:02, Andreas Pakulat wrote:
> > On 13.09.06 21:26:51, Dave S wrote:
> > > I now have my widget appearing on screen in a modal fashion thanks to
> > > Andreas
> > >
> > > f1 = form1(self)
> > > if f1.exec() == QDialog.Accepted:
> > > 	script ...
> > > else:
> > > 	script ...
> > >
> > > However this only allows the communication of two states from the widget,
> > > either accept() or close() so I can only really have an OK button
> > > (accept) and a quit button (close).
> > >
> > > Is there a way to signal a third state for a third button ? My GUI would
> > > be far more logical if it were possible.
> >
> > Not in the way above. For that to happen you'd need to connect each
> > button to a separate slot. Inside the slots you set a member variable
> > which reflects the button that was pressed (i.e. an int with values
> > 0,1,2 depending on the button) and just call close() after that. This
> > will close the dialog. When calling the dialog you just do:
> >
> > f1.exec()
> 
> when you say .exec() you mean .exec_loop() ? 

Yes, exec_loop is used in python. Sorry for the confusion, I tend to
forget about the PyQt specifics, especially when I'm working with C++
Qt...

Andreas

-- 
Ships are safe in harbor, but they were never meant to stay there.




More information about the PyQt mailing list