Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fancy menu #1

Open
mottosso opened this issue Sep 22, 2016 · 0 comments
Open

Fancy menu #1

mottosso opened this issue Sep 22, 2016 · 0 comments
Labels

Comments

@mottosso
Copy link
Member

Goal

Stand out from traditional menus with larger item, icon, an image of resulting GUI along with a description of what it is for.

Implementation

Generate your own menu and place it amongst other menus.

from maya import cmds
from Qt import QtCore, QtWidgets

cmds.menu("MyMenu", parent="MayaWindow")
widgets = {w.objectName(): w for w in QtWidgets.qApp.allWidgets()}
parent = widgets["MayaWindow"]
menu = widgets["MyMenu"]

def opening(*args):
    widget = QtWidgets.QMenu(parent)
    widget.setTearOffEnabled(True)
    widget.move(menu.pos())
    widget.resize(200, 150)
    widget.show()

menu.aboutToShow.connect(opening)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant