diff --git a/README.md b/README.md index bed5cc9..99ff7b3 100644 --- a/README.md +++ b/README.md @@ -106,4 +106,31 @@ modifier = QtCore.Qt.ControlModifier | QtCore.Qt.ShiftModifier menu = ScriptsMenu() menu.register_callback(modifier, callback) +``` + +#### Update menu + +The ScriptsMenu has a signal called "updated" which can be connected to a function which +rebuilds the menu + +```python +# This example is tested in Autodesk Maya +import scriptsmenu.launchformaya as launchformaya + +# Here we create our own menu without any scripts +menu = launchformaya.main(title="Custom Menu") + +# Set the update button visible, which is hidden by default +menu.set_update_visible(True) + +# Add a custom script to the menu +menu.add_script(parent=menu, title="Before", command='print("C")', sourcetype="python") + +# Create update function +def update(menu): + menu.clear_menu() + menu.add_script(parent=menu, title="After", command='print("C")', sourcetype="python") + +# Link the update function to the update signal +menu.updated.connect(update) ``` \ No newline at end of file