1 Star 0 Fork 0

Promise / StarParty

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
test.py 1019 Bytes
一键复制 编辑 原始数据 按行查看 历史
Promise 提交于 2024-03-08 22:41 . feat:tests
import win32gui
import win32con
import pyautogui
import logging
# 设置日志
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - [ 小助手 ] : %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
logger = logging.getLogger(__name__)
# 屏幕截屏
def capture_window_screenshot(handle, filename):
left, top, right, bottom = win32gui.GetWindowRect(handle)
width = right - left
height = bottom - top
screenshot = pyautogui.screenshot(region=(left, top, width, height))
screenshot.save(filename)
logger.info("窗口截图已保存为: %s", filename)
# 窗口前置
def bring_window_to_front(handle):
win32gui.ShowWindow(handle, win32con.SW_RESTORE)
win32gui.BringWindowToTop(handle)
win32gui.SetForegroundWindow(handle)
# 将窗口设置为指定大小
def set_window_size(handle, width, height):
win32gui.SetWindowPos(handle, win32con.HWND_TOP, 0, 0, width, height, win32con.SWP_NOZORDER)
if __name__ == "__main__":
im = pyautogui.screenshot('Test.png')
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Dream_club/star-party.git
git@gitee.com:Dream_club/star-party.git
Dream_club
star-party
StarParty
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891