Jump to content

PyQT Window keeps reopening on initial opening of hip file

Recommended Posts

hey guys,

I have a pyQT window that is parented to the main Houdini Window but every time I reopen the scene it's opens the PyQT window again.


class Manager(QtWidgets.QDialog):
    def __init__(self, parent=None):
        super(Manager, self).__init__(parent)

        self.setFixedSize(700, 450)

dialog = Manager()
dialog.setParent(hou.ui.mainQtWindow(), QtCore.Qt.Window)

According to the docs I need to unparent it in the close event which I have done but it still seems to open. What am I missing?

def closeEvent(self, event):


Share this post

Link to post
Share on other sites
3 hours ago, shadowst17 said:

What am I missing?

The point of parenting.

You most likely want your UI shown on-demand (i.e clicking a shell button, menu or in python panel). Parenting to the main and not expecting it to show up doesn't make much sense.

3 hours ago, shadowst17 said:

every time I reopen the scene

Which means you have your code executed either in 123/456.py or in hou.session or in HDA's event handlers. Decide when you want this ui to be shown and call dialog.show() from there.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now