Skip to main content

capture

Screen Capture.
from IPython.display import display, Image

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.


source

start_share

async def start_share():

Ask the browser to share a screen or window, for capture_screen

await start_share()

source

capture_screen

async def capture_screen(
    timeout:int=15
):

Capture the shared screen as a PIL image.


source

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