I just recently ran into this problem too and figured it was nuke deleting my
object, so my hack was to do something like this:
myMenu.addCommand("My PyQt Window", "t =PyQtTest.myDialog();t.show()")
I'm sure there is a better way as well but I just haven't looked that hard into
it, so I'm looking for an answer too!
Thanks!
Jake
----- Original Message -----
From: "Gerard Keating" <[email protected]>
To: "Nuke Python discussion" <[email protected]>
Sent: Monday, August 8, 2011 8:22:50 AM
Subject: [Nuke-python] Re: Nuke6.3v1 and pyqt from menu bar
Hi,
So I think I figured this out. The QLabel object no longer exists
outside the scope of the function so when the funciton returns it
cleans up and deletes the QLabel object. One way around this which I
found from the pyQtRender2 example is to add a nuke callback that
calls the QLabel(makes more sense here if we are talking about
dialogs) object hence keeping it alive. I am sure there is a better
solution but that works for me.
Regards,
Gerard Keating.
On 8 August 2011 12:50, Gerard Keating <[email protected]> wrote:
> Hi,
> I am just trying to show a pyqt panel from the menu bar without using
> pyQtAppUtils.py helper functions because they are no longer necessary
> according to the documentation in nuke6.3v1 64 bit on linux.
> So I have this in my menu.py :
>
>
> def showPanel():
> from PyQt4 import QtGui
> nuke.tprint("Showing panel")
> label = QtGui.QLabel( "Hello World" )
> label.show()
> nuke.tprint("Finished showing panel")
> menubar = nuke.menu('Nuke')
> fileMenu = menubar.findItem('File')
> fileMenu.addCommand("Test panel", showPanel)
>
> But the label does not stay on the screen.
> I am probably doing something stupid but can anyone see what it is?
> Thanks,
> Gerard Keating
>
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
--
--
--------------------------------------------
[email protected] 203-992-6319
LTD Blue Sky Studios
--------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python