They are not the same, and also not doing what you said...

*menu = QMenu("menu", self.setCameraBtn)*

This creates a brand new QMenu, with the setCameraBtn as its parent, and
then simply leaks it (the object remains for the life of the application,
but is never used). It is never set as the actual menu on the button.
Nothing changes.

*self.setCameraBtn.menu()*

This method retrieves the currently set QMenu on the button. It does not
create new menus when you call it.

If you want to actually set the menu on the button, use setMenu()



On Wed, Oct 8, 2014 at 4:32 PM, likage <[email protected]> wrote:

> I see and I do not think there is a need for me to define an instance
> attribute - self.__camLs seeing that I am not really using it anywhere...
>
> By the way, may I ask if *menu = QMenu("menu", self.setCameraBtn)* is not
> equivalent to *menu = self.setCameraBtn.menu()*? Can I take it that the
> latter one creates a new menu while the former is attaching the QMenu onto
> the *setCameraBtn?*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/2492857a-9e98-4131-affb-1f1cc348b5de%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/2492857a-9e98-4131-affb-1f1cc348b5de%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0YaOj_9XoY-sqWJ7e7P%2BXQ89he-9f210EuaMYhZ9QtXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to