from IPython.display import display, Imagecapture
Screen Capture.
start_share asks the browser to share a screen or window, which the user picks. capture_screen then grabs a frame of it. Both send screenshot.js with their browser call, so no setup step is needed.
await start_share()capture_screen
async def capture_screen(
timeout:int=15
):Capture the shared screen as a PIL image.
capture_tool
async def capture_tool(
timeout:int=15
):Capture the screen. Re-call this function to get the most recent screenshot, as needed. Use default timeout where possible
After the user picks a window to share, capture_screen grabs a frame of it:
img = await capture_screen()
img.thumbnail((700,700))
img