截图文件夹和脚本

This commit is contained in:
2024-12-07 16:20:46 +08:00
parent f9b56292e7
commit 0a003367f9
58 changed files with 80 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 268 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

80
截屏幕文件.py Normal file
View File

@@ -0,0 +1,80 @@
import tkinter as tk
from tkinter import simpledialog
import pyautogui
import keyboard
import os
# 全局变量,用于存储文件夹路径
save_folder = ""
# 创建状态显示窗口
def create_status_window():
window = tk.Tk()
window.title("截图工具状态")
window.geometry("200x100")
window_position = f"+{window.winfo_screenwidth() - 220}+{window.winfo_screenheight() - 150}"
window.geometry(window_position)
# 设置窗口始终在最前面
window.attributes('-topmost', True)
label = tk.Label(window, text="", font=("Arial", 12))
label.pack(expand=True)
return window, label
# 更新状态信息
def update_status(label, text):
label.config(text=text)
label.update()
# 创建文件夹
def create_folder():
global save_folder
root = tk.Tk()
root.withdraw() # 隐藏主窗口
folder_name = simpledialog.askstring("输入", "请输入文件夹名称:", parent=root)
if folder_name:
save_folder = os.path.join(os.getcwd(), folder_name)
if not os.path.exists(save_folder):
os.makedirs(save_folder)
update_status(status_label, "文件夹创建成功")
else:
update_status(status_label, "文件夹已存在")
root.destroy()
# 截屏并保存
def take_screenshot():
if not save_folder:
update_status(status_label, "请先创建文件夹")
return
screen_width, screen_height = pyautogui.size()
left = screen_width // 2 - 400
top = 0
right = screen_width // 2 + 400
bottom = screen_height
screenshot = pyautogui.screenshot(region=(left, top, right - left, bottom - top))
file_path = os.path.join(save_folder, f"screenshot_{len(os.listdir(save_folder)) + 1}.png")
screenshot.save(file_path)
update_status(status_label, "截图成功")
# 主函数
def main():
global status_window, status_label
status_window, status_label = create_status_window()
keyboard.add_hotkey('F8', create_folder)
keyboard.add_hotkey('F9', take_screenshot)
update_status(status_label, " ready")
status_window.mainloop()
if __name__ == "__main__":
main()

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 172 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB