Post #1303: ![](https://blenderartists.org/user_avatar/blenderartists.org/mickhanks/48/77779

πŸ“‹ Metadata

🏷️ Tags

popup-dialog python-scripting advanced solved

  • Popup Dialog Editor
  • Python Scripting
  • Modal Editor
  • Custom Operators

πŸ’¬ Content

MickHanks:

Trying to add a one button screen sizer to the Header of a split screen.
Copied bpy.ops.screen.area_move(x=1326, y=483, delta=-31) to a Popup and added it to my other Header buttons. But it doesn’t work.
What is β€œDelta”?

Nice idea!
x, y - edge location in pixels
delta - move distance in pixels.

To use area_move operator in python we need to move the cursor over the edge we want to move using C.window.cursor_warp(x, y).
The problem is that cursor_warp function needs some time to work. So we need to execute area_move operator with some delay using bpy.ops.pme.timeout(cmd=β€œβ€, delay=0.0001) operator.

Here is an example:

a = C.area; x = a.x + (a.width >> 1); y = a.y + a.height; C.window.cursor_warp(x, y); bpy.ops.pme.timeout(delay=0.0001, cmd="bpy.ops.screen.area_move(x=%d, y=%d, delta=-100)" % (x, y))

πŸ”— View on Blender Artists