Split popup into multiple parts or move to cursor position

Hi folks!

Is there a way to split popup in two parts or at least place cursor at the red cross position?
It is kind of possible with pie menu but I want to have support for multiple clicks before closing the popup.



split popup in two parts

place cursor at the red cross position

support for multiple clicks before closing the popup

What do you really want? How do you create/call the popup?

Maybe this example will help somehow:

I use this method to show a popup:

def invoke(self, context, event):
    return context.window_manager.invoke_popup(self, width=180)

I can’t set position where it will be shown relative to cursor (or at least don’t know how to).
As an example, the Ctrl+Shift+Tab (default ‘Snap to’ popup) shows under active element.

Hi @DotBow,

I don’t think manual offsetting / positioning is supported yet. There are also constraints, that handle the placement if the mousecursor is near the screenborder. For operators you can define the main property. That gets utilized within popups.

Beside that I think a hacky solution could be to store the events mouse position and alter the mousecursor pos before opening the popup and then restore it afterwards.


But I haven’t tested this.

1 Like

Thanks for links!
This one does what I need, only corner situations needed some love:

def invoke(self, context, event):
    x = event.mouse_x
    y = event.mouse_y
    context.window.cursor_warp(x - 90, y + 120)
    context.window_manager.invoke_popup(self, width=180)
    context.window.cursor_warp(x, y)
    return {'RUNNING_MODAL'}
1 Like

Good to hear it worked. :+1: One last thought.Be careful if the dimensions in pixels of popups is different on hidpi screens and if the ui scale is different. You might want to scale your offset relative to the present dpi and ui scale. :slightly_smiling_face:

  • bpy.context.preferences.system.dpi
  • bpy.context.preferences.view.ui_scale
1 Like