rs.PopupMenu location is wrong

Been meaning to post this for a long time…

Here is the Help item for PopupMenu:

So, if I don’t specify a point, it should popup under the cursor. If the script that calls PopupMenu is in a toolbar button, then it should popup in close proximity to the button, as that’s where the cursor is. But it doesn’t - it pops up far below and to the right.

You can test with this - just copy and paste into a new toolbar button:

NoEcho ! _-RunPythonScript (
import rhinoscriptsyntax as rs
cl=["AAA","BBB","CCC","DDD","EEE"]
choice=rs.PopupMenu(cl)
print choice
)