Showing results for 
Search instead for 
Did you mean: 

Change state of ribbon buttons dynamically


Dear All,


I am using the NX 10 Open Python API. Currently I try to enable/disable ribbon buttons event based for a custom ribbon that I have created with .rtb, .grb and .men files.


My goal is to enable/disable buttons such as the build-in "Edit Post View" button in the build-in Results ribbon. This button is visible but disabled (not clickable) by default and after a result file exists the button state changed to enabled (clickable).


In my case if have a similar situation where some buttons should be clickable only after some event occured. How can I add this button state change via the NX Open Python API?


Best regards,




Re: Change state of ribbon buttons dynamically

Siemens Phenom Siemens Phenom
Siemens Phenom

Assuming your button was defined in a .MEN file, I think you can enable and disable it with the Python wrapper for the Open C call UF_MB_set_button_sensitivity().  You may also need UF_MB_ask_button_id().

Re: Change state of ribbon buttons dynamically



Thanks Steve for your reply. In the meanwhile I discovered a solution which is close to what you proposed. My solution is:



import NXOpen
import NXOpen.MenuBar

state = NXOpen.MenuBar.MenuButtonSensitivityStatus.Insensitive
butns = ['MY_BTN_1',
for btn in butns:
    NXOpen.UI.GetUI().MenuBarManager.GetButtonFromName(btn).ButtonSensitivity = state



Here I assume that the buttons MY_BTN_1 and MY_BTN_2 are defined in my own .men file