📋 Metadata
- Author: roaoao
- Date: 2018-04-01 12:50:03
- Type:
answer - Reply to: post_01301
- Replies (3): post_01304, post_02338, post_03512
💬 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))