# how to get the vertice's Horizontal and vertical location in the window?

actually I'm trying to get the vertice position in the blender's window

thanks to bpy.context.window.width and bpy.context.window.height I know the windows size but how to get the vertice's Horizontal and vertical location in the window?

I think it is possible because I can set the cursor (Operating System cursor) to some location with cursor_warp

thanks for any help

There is a function that does the conversion from 3d space to 2d view area location_3d_to_region_2d see the DOC : in this example, i get the 2d coordinates in the area, window and the system screen

import bpy
from bpy_extras import view3d_utils

oa = bpy.context.active_object

for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
viewport = area.regions[4]
for v in bpy.context.object.data.vertices :
#coo in 3d space
co_3d = oa.matrix_world * v.co
#coo in the 3d view area (2d)
co_2d = view3d_utils.location_3d_to_region_2d(viewport, area.spaces[0].region_3d, co_3d)
#coo in the blender window
co_2d_w = (co_2d[0]+viewport.x, co_2d[1]+viewport.y)
#coo in the system screen
co_2d_s = (co_2d_w[0]+bpy.context.window.x, co_2d_w[1]+bpy.context.window.y)
#display
print("\n\n3d space co :",co_3d,"\n2d in viewport co :",co_2d)
print("2d in window co :",co_2d_w,"\n2d system co :",co_2d_s)


NOTE : this is what window ,area and region stands for in blender :