Post #1303: : post_01304, post_02338, post_03512
π·οΈ Tags
popup-dialog python-scripting advanced solved
βοΈ Related PME Features
- 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))