[PyKDE] Issue with QDialog and lifetime

Toby Dickenson tdickenson at devmail.geminidataloggers.co.uk
Thu May 26 09:58:07 BST 2005


On Wednesday 25 May 2005 16:13, Giovanni Bajo wrote:

> So, I don't see any easy way to take care of this automatically. One has to
> remember to manually destroy the dialog calling deleteLater 

Yes. My PyQt idiom for running a dialog is:

    dlg = WhateverDlg(parent)
    try:
        ok = dlg.exec_loop()
        if ok:
            # do things in here maybe
    finally:
        dlg.deleteLater()

which isnt so bad.

> (which kind of 
> sucks because it means that we are back to manually memory management for
> dialogs)

There has been recent discussion on the python-dev list for syntactic support 
for this. http://www.python.org/peps/pep-0343.html 


-- 
Toby Dickenson




More information about the PyQt mailing list