1) How are you deleting the QFrame?
2) Are you just testing this in the script editor, or as part of a script that 
is running?

Make sure you are using:   anObject.deleteLater()
This will put a request in the event loop queue to perform the deletion when 
control returns from the current scope.

If you are just testing this in the script editor, you may be fighting the 
garbage collector (just a guess). 

There is also a way to check if the underlying C++ object still exists or not:

import sip
sip.isdeleted(frame) 





On Sep 3, 2012, at 1:06 AM, PBLN RAO wrote:

> Justin,
> 
> if i delete the window in maya once shown.
> and use the any of the below method (for ex : 
> mainWin.findChildren(QtGui.QFrame, "framie3") )
> 
> its still returning the value. 
> 
> i think the window is not removed/destroyed permanently.
> 
> How to overcome this. 
> 
> On Friday, August 31, 2012 9:56:06 PM UTC+5:30, Justin Israel wrote:
> There are a couple ways. 
> 
> 1) You can use the Maya API 
> 
> import maya.OpenMayaUI as mui 
> import sip 
> 
> # frame_ptr would be None if it wasn't found 
> frame_ptr = mui.MQtUtil.findControl("framie") 
> if frame_ptr: 
>     frame = sip.wrapinstance(long(frame_ptr), QtGui.QFrame) 
> 
> 2) You can search every widget in the app 
> 
> matches = [w for w in QtGui.qApp.allWidgets() if w.objectName()=='framie'] 
> 
> 3) If your frame is properly parented to the Maya QMainWindow or any 
> other QWidget, you can search by children: 
> 
> # if the main window is the parent 
> main_ptr = mui.MQtUtil.mainWindow() 
> mainWin = sip.wrapinstance(long(main_ptr), QtGui.QWidget) 
> 
> mainWin.findChildren(QtGui.QFrame, "framie3") 
> 
> 
> On Fri, Aug 31, 2012 at 12:41 AM, PBLN RAO <[email protected]> wrote: 
> > Hi All, 
> > 
> >   I have a window created with PyQt in maya. i wan to check if a 
> > particulate 
> > frame (QFrame) exists. 
> > 
> >   lets say i have a QFrame (Frame_Test) in window. 
> > 
> >   I want to know f Frame_Test exists in window, so that i will create a new 
> > frame dynamically as required. 
> > 
> > -- 
> > view archives: http://groups.google.com/group/python_inside_maya 
> > change your subscription settings: 
> > http://groups.google.com/group/python_inside_maya/subscribe 
> 
> -- 
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings: 
> http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to