When I applied the above code, the window selection screen appears, but after selecting the window I want to capture, nothing is displayed on the screen. Is there a way to resolve this issue?
import turtle
from winsdk._winrt import initialize_with_window
from winsdk.windows.foundation import IAsyncOperation, AsyncStatus
from winsdk.windows.graphics.capture import GraphicsCapturePicker, GraphicsCaptureItem
def on_pick_completed(op: IAsyncOperation, status: AsyncStatus) -> None:
if status == AsyncStatus.ERROR:
print("error: ", status.error_code.value)
elif status == AsyncStatus.CANCELED:
this is programatically, canceled, not user canceled
print("operation canceled")
elif status == AsyncStatus.COMPLETED:
result: Optional[GraphicsCaptureItem] = op.get_results()
if result:
print("result:", result.display_name)
else:
print("user canceled")
op.close()
Originally posted by @dlech in https://github.com/microsoft/xlang/issues/756#issuecomment-1141261907
When I applied the above code, the window selection screen appears, but after selecting the window I want to capture, nothing is displayed on the screen. Is there a way to resolve this issue?
import turtle
from winsdk._winrt import initialize_with_window from winsdk.windows.foundation import IAsyncOperation, AsyncStatus from winsdk.windows.graphics.capture import GraphicsCapturePicker, GraphicsCaptureItem
def on_pick_completed(op: IAsyncOperation, status: AsyncStatus) -> None: if status == AsyncStatus.ERROR: print("error: ", status.error_code.value) elif status == AsyncStatus.CANCELED:
this is programatically, canceled, not user canceled
picker = GraphicsCapturePicker() initialize_with_window(picker, turtle.getcanvas().winfo_id()) op = picker.pick_single_item_async() op.completed = on_pick_completed
turtle.mainloop()