Skip to content

get_screenshot.py

LopeKinz edited this page Jul 6, 2023 · 1 revision

get_screenshot.py

The get_screenshot.py module provides a function to capture and save a screenshot using the pyautogui library.

Usage

To use the get_screenshot function, follow these steps:

  1. Import the get_screenshot module into your Python script:

    import get_screenshot
  2. Call the get_screenshot function to capture a screenshot and save it to a file:

    screenshot_path = get_screenshot.get_screenshot()

Functions

get_screenshot()

Captures a screenshot of the entire screen and saves it to a file.

Returns
  • scrn_path (str): The file path where the screenshot is saved.
Example
import get_screenshot

screenshot_path = get_screenshot.get_screenshot()
print("Screenshot saved to:", screenshot_path)

Dependencies

The get_screenshot.py module requires the following dependencies:

  • pyautogui: A library for GUI automation.

Notes

  • The screenshot file will be saved in the same directory as the get_screenshot.py module.
  • The screenshot file name will follow the format: Screenshot_HHMMSS_YYYY-MM-DD_<hostname>.png, where:
    • HHMMSS represents the current time in hours, minutes, and seconds.
    • YYYY-MM-DD represents the current date in year, month, and day.
    • <hostname> represents the hostname of the machine where the screenshot is captured.
Clone this wiki locally