Ich bin ein Student und muss eine Menge Dinge durch .pdf für Online -Kurse lesen und muss sie ausdrucken. Während ich im Internet surft, fand ich ein Skript, das mir helfen würde, PDFs zu erstellen und sie in Bilddateien zu konvertieren.
Ich bin ein Student und muss eine Menge Dinge durch .pdf für Online -Kurse lesen und muss sie ausdrucken. Während ich im Internet surft, fand ich ein Skript, das mir helfen würde, PDFs zu erstellen und sie in Bilddateien zu konvertieren.[code]import win32api, win32con import time # MOUSECLICK
y = y + 1 # PUT SCREENSHOT FUNCTION HERE# needs click and screenshot function while (countshots < pagenumber): gamechar = str(countshots) + '.png' with mss.mss() as sct: # The screen part to capture monitor = {'top': top, 'left': left, 'width': width, 'height': height}
# output = 'sct-{top}x{left}_{width}x{height}.png'.format(**monitor) output = gamechar.format(**monitor) # Grab the data sct_img = sct.grab(monitor)
# Save to the picture file mss.tools.to_png(sct_img.rgb, sct_img.size, output)
click(GX3, GY3) countshots = countshots + 1 break [/code] Dieses unten ist [b]Tools.py[/b] [code]""" This is part of the MSS Python's module. Source: https://github.com/BoboTiG/python-mss """
import os import struct import zlib from typing import TYPE_CHECKING
if TYPE_CHECKING: from typing import Optional, Tuple # noqa
def to_png(data, size, level=6, output=None): # type: (bytes, Tuple[int, int], int, Optional[str]) -> Optional[bytes] """ Dump data to a PNG file. If `output` is `None`, create no file but return the whole PNG data.
width, height = size line = width * 3 png_filter = pack(">B", 0) scanlines = b"".join( [png_filter + data[y * line : y * line + line] for y in range(height)] )
if not output: # Returns raw bytes of the whole PNG data return magic + b"".join(ihdr + idat + iend)
with open(output, "wb") as fileh: fileh.write(magic) fileh.write(b"".join(ihdr)) fileh.write(b"".join(idat)) fileh.write(b"".join(iend))
# Force write of file to disk fileh.flush() os.fsync(fileh.fileno())
return None
< /code> Dies ist der Fehler, den ich erhalte, < /p> Traceback (most recent call last): File "E:/PYTHON PROJECTS/main.py", line 175, in mss.tools.to_png(sct_img.rgb, sct_img.size, output) File "E:\PYTHON PROJECTS\venv\lib\site-packages\mss\tools.py", line 47, in to_png idat = {b"", b"IDAT", zlib.compress(scanlines, level), b""} TypeError: an integer is required (got type str)
Process finished with exit code 1
[/code] Ich habe kein oder wenig Wissen, warum dies nicht funktioniert.>
Die Idee ist, den Sekundärbildschirm zu überwachen, ohne einen physischen Monitor zu benötigen. Das Bild geht an einen Projektor in einem anderen Raum.
Dieser Fehler tritt auf root2: You clicked at...
Ich habe ein Projekt, bei dem Benutzer häufig Annotated verwenden müssen. Um es zu vereinfachen, versuche ich, einen generischen Typ zu erstellen
T = TypeVar('T')
CustomUrl = Annotated