Skip to content

feat: screenshot and print utils#34

Merged
mscolnick merged 1 commit intomainfrom
ms/screenshot-print
Feb 12, 2026
Merged

feat: screenshot and print utils#34
mscolnick merged 1 commit intomainfrom
ms/screenshot-print

Conversation

@mscolnick
Copy link
Contributor

@mscolnick mscolnick commented Feb 12, 2026

  • Add 4 new browser utilities: PrintPageButton, print_page(), ScreenshotButton, and screenshot() — each as a button widget + programmatic function pair
  • Screenshot utilities dynamically load modern-screenshot from esm.sh for zero Python dependencies

New Widgets

Print

PrintPageButton — a button that opens the browser print dialog:

from moutils import PrintPageButton

btn = PrintPageButton()
btn

print_page() — programmatically trigger print (e.g. behind a run_button):

from moutils import print_page

print_page_button = mo.ui.run_button(label="Print page")
print_page_button

# in another cell:
if print_page_button.value:
    print_page()

Screenshot

ScreenshotButton — a button that captures a DOM element as a PNG download:

from moutils import ScreenshotButton

btn = ScreenshotButton(locator="body", filename="page.png")
btn

screenshot() — programmatically capture a screenshot (e.g. of a specific cell):

from moutils import screenshot

take_screenshot = mo.ui.run_button(label="Take screenshot")
take_screenshot

# in another cell:
if take_screenshot.value:
    screenshot(locator="[data-cell-name='my_cell']", filename="page.png")

@mscolnick mscolnick requested a review from koaning February 12, 2026 22:40
@mscolnick mscolnick merged commit 4c67917 into main Feb 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant