[PyQt] PyQt4 window not properly closing with signals From.close

David Boddie david at boddie.org.uk
Mon Jun 11 20:39:06 BST 2012

On Mon, 11 Jun 2012 15:45:53 +0530, Ganesh Kumar wrote:

> I am new to pyqt, I try two qt designer files one is main window
> second sub window,
> Load main window click button open new window <allow things to happen>
> user clicks exit on that window close sub window return to main window
> I am tried with Form.close , window.deletelater Not working for me. I
> have attached my code please guide me guys.
> http://pastebin.com/UnHS0NRn

In the sub_window.dosumfunction() method, you cannot easily get access to the
widget itself.

Really, you should avoid modifying the code generated by pyuic4 and instead
create new widget classes where you define new methods. This approach allows
you to change the UI in Designer and regenerate the code without having to
edit the file again.

There seems to be many assignments to self and Form, and it isn't clear to me
what you wrote and what pyuic4 wrote. Anyway, I modified the code a little so
that it works, but the code could be improved:


It might be useful for you to look at some tutorials for Designer and pyuic4.
One can be found here:


A list of other tutorials can be found on this page:



More information about the PyQt mailing list