I have been learning about callbacks and created this -> https://pastebin.com/pMgaDQPw <https://l.messenger.com/l.php?u=https%3A%2F%2Fpastebin.com%2FRmYBiEUh&h=ATO7bNQRO31Vu4PwvLcYqbCp4FxNu1On2QpwGcJGOrkLFjx-GlRkqDdH4c9pUeJwZRjdhf0nGuY8Ftbw4_qN6HYZv5VUeqjNtJgOPeAWemvWk_o8KC8ccvdHfYIIBQ>
But keep coming back with an error: // Error: RuntimeError: file <maya console> line 41: popupMenu: Object 'window1|columnLayout3|button25|popupMenu120' not found. // // Warning: Python callback failed // On Monday, 8 May 2017 15:39:34 UTC-4, Justin Israel wrote: > > > > On Tue, May 9, 2017, 7:34 AM <[email protected] <javascript:>> wrote: > >> On Sunday, 7 May 2017 17:48:26 UTC-4, Justin Israel wrote: >> > On Sun, May 7, 2017 at 6:57 PM <[email protected]> wrote: >> > Hey all, >> > >> > >> > >> > Trying to query selected radio Button in a popupMenu then Print the it. >> I know in cmds.radioCollection they have a flag called "select" but for >> cmds.radioMenuItemCollection the flag select doesn't exist. >> > >> > >> > >> > import maya.cmds as cmds >> > >> > >> > >> > #creates Window >> > >> > myWindow = cmds.window( width=150, h = 200 ) >> > >> > cmds.columnLayout( adjustableColumn=True ) >> > >> > >> > >> > #lists Cameras >> > >> > Cams = cmds.listCameras(p=True) >> > >> > #Run Button >> > >> > cmds.button(l="go", c = Cprint) # I know the Command it wrong! just to >> discribe what i am looking for >> > >> > cmds.popupMenu() >> > >> > cmds.radioMenuItemCollection() >> > >> > #creates Radio Menu >> > >> > for i in Cams: >> > >> > btnName = str(i) >> > >> > RCam = cmds.menuItem( btnName,rb= True, label=btnName) >> > >> > >> > >> > #shows Window >> > >> > cmds.showWindow(myWindow) >> > >> > >> > >> > >> > >> > def Cprint(*arg): >> > >> > print RCam # aka Selected Camera >> > >> > >> > >> > >> > >> > Any help would be Amazing! >> > >> > >> > >> > - Adam >> > >> > >> > >> > >> > >> > One way would be to keep a list of your menu items, and then wait until >> the end to create a closure over those items, and set that as the button >> callback: >> > https://pastebin.com/ncDKphbm >> > >> > >> > >> > You can ask each menu item if its radio button value is True >> > >> > >> > >> > -- >> > >> > 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] <javascript:> >> . >> > >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/7f71af79-cfad-4094-80bb-e7499b531ef9%40googlegroups.com >> . >> > >> > For more options, visit https://groups.google.com/d/optout. >> >> Justin - Do you know of a way to keep the menu Items I am creating >> updated? so if you create a new camera in the scene the script adds a new >> menuItem and same if you delete it ? >> > > > http://help.autodesk.com/cloudhelp/2016/ENU/Maya-Tech-Docs/CommandsPython/popupMenu.html > > You can set a callback for the post command, which will get called every > time the menu is about to be shown. You can actually set you menu up this > way in the first place so that you don't check the camera list until the > menu is going to show. You will need to clear it each time or manually > manage the difference. > > >> >> -- >> 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] <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/f1bfd152-7d86-4e90-82fa-221c7f8aa4ac%40googlegroups.com >> . >> 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/503a66de-b733-4825-b936-4818eb4258b8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
