ScreenCut/main.py

22 lines
440 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import pinPicture
from PIL import Image
import tkinter as tk
import pyautogui
import keyboard
def capture_screen():
screenshot = pyautogui.screenshot()
root = tk.Tk()
image = screenshot.convert('RGBA')
pin = pinPicture.PinPicture(image, root)
root.mainloop()
# 监听特定快捷键这里假设是Ctrl+Alt+S
keyboard.add_hotkey('F7', capture_screen)
# 保持程序运行,持续监听快捷键
keyboard.wait()