init
371
.venv/lib/python3.8/site-packages/pygame/__init__.py
Normal file
|
|
@ -0,0 +1,371 @@
|
|||
# coding: ascii
|
||||
# pygame - Python Game Library
|
||||
# Copyright (C) 2000-2001 Pete Shinners
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Pete Shinners
|
||||
# pete@shinners.org
|
||||
"""Pygame is a set of Python modules designed for writing games.
|
||||
It is written on top of the excellent SDL library. This allows you
|
||||
to create fully featured games and multimedia programs in the python
|
||||
language. The package is highly portable, with games running on
|
||||
Windows, MacOS, OS X, BeOS, FreeBSD, IRIX, and Linux."""
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Choose Windows display driver
|
||||
if os.name == "nt":
|
||||
# pypy does not find the dlls, so we add package folder to PATH.
|
||||
pygame_dir = os.path.split(__file__)[0]
|
||||
os.environ["PATH"] = os.environ["PATH"] + ";" + pygame_dir
|
||||
|
||||
# when running under X11, always set the SDL window WM_CLASS to make the
|
||||
# window managers correctly match the pygame window.
|
||||
elif "DISPLAY" in os.environ and "SDL_VIDEO_X11_WMCLASS" not in os.environ:
|
||||
os.environ["SDL_VIDEO_X11_WMCLASS"] = os.path.basename(sys.argv[0])
|
||||
|
||||
|
||||
class MissingModule:
|
||||
_NOT_IMPLEMENTED_ = True
|
||||
|
||||
def __init__(self, name, urgent=0):
|
||||
self.name = name
|
||||
exc_type, exc_msg = sys.exc_info()[:2]
|
||||
self.info = str(exc_msg)
|
||||
self.reason = f"{exc_type.__name__}: {self.info}"
|
||||
self.urgent = urgent
|
||||
if urgent:
|
||||
self.warn()
|
||||
|
||||
def __getattr__(self, var):
|
||||
if not self.urgent:
|
||||
self.warn()
|
||||
self.urgent = 1
|
||||
missing_msg = f"{self.name} module not available ({self.reason})"
|
||||
raise NotImplementedError(missing_msg)
|
||||
|
||||
def __nonzero__(self):
|
||||
return False
|
||||
|
||||
__bool__ = __nonzero__
|
||||
|
||||
def warn(self):
|
||||
msg_type = "import" if self.urgent else "use"
|
||||
message = f"{msg_type} {self.name}: {self.info}\n({self.reason})"
|
||||
try:
|
||||
import warnings
|
||||
|
||||
level = 4 if self.urgent else 3
|
||||
warnings.warn(message, RuntimeWarning, level)
|
||||
except ImportError:
|
||||
print(message)
|
||||
|
||||
|
||||
# we need to import like this, each at a time. the cleanest way to import
|
||||
# our modules is with the import command (not the __import__ function)
|
||||
# isort: skip_file
|
||||
|
||||
# first, the "required" modules
|
||||
from pygame.base import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
|
||||
from pygame.constants import * # now has __all__ pylint: disable=wildcard-import; lgtm[py/polluting-import]
|
||||
from pygame.version import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
|
||||
from pygame.rect import Rect
|
||||
from pygame.rwobject import encode_string, encode_file_path
|
||||
import pygame.surflock
|
||||
import pygame.color
|
||||
|
||||
Color = pygame.color.Color
|
||||
import pygame.bufferproxy
|
||||
|
||||
BufferProxy = pygame.bufferproxy.BufferProxy
|
||||
import pygame.math
|
||||
|
||||
Vector2 = pygame.math.Vector2
|
||||
Vector3 = pygame.math.Vector3
|
||||
|
||||
__version__ = ver
|
||||
|
||||
# next, the "standard" modules
|
||||
# we still allow them to be missing for stripped down pygame distributions
|
||||
if get_sdl_version() < (2, 0, 0):
|
||||
# cdrom only available for SDL 1.2.X
|
||||
try:
|
||||
import pygame.cdrom
|
||||
except (ImportError, IOError):
|
||||
cdrom = MissingModule("cdrom", urgent=1)
|
||||
|
||||
try:
|
||||
import pygame.display
|
||||
except (ImportError, IOError):
|
||||
display = MissingModule("display", urgent=1)
|
||||
|
||||
try:
|
||||
import pygame.draw
|
||||
except (ImportError, IOError):
|
||||
draw = MissingModule("draw", urgent=1)
|
||||
|
||||
try:
|
||||
import pygame.event
|
||||
except (ImportError, IOError):
|
||||
event = MissingModule("event", urgent=1)
|
||||
|
||||
try:
|
||||
import pygame.image
|
||||
except (ImportError, IOError):
|
||||
image = MissingModule("image", urgent=1)
|
||||
|
||||
try:
|
||||
import pygame.joystick
|
||||
except (ImportError, IOError):
|
||||
joystick = MissingModule("joystick", urgent=1)
|
||||
|
||||
try:
|
||||
import pygame.key
|
||||
except (ImportError, IOError):
|
||||
key = MissingModule("key", urgent=1)
|
||||
|
||||
try:
|
||||
import pygame.mouse
|
||||
except (ImportError, IOError):
|
||||
mouse = MissingModule("mouse", urgent=1)
|
||||
|
||||
try:
|
||||
import pygame.cursors
|
||||
from pygame.cursors import Cursor
|
||||
except (ImportError, IOError):
|
||||
cursors = MissingModule("cursors", urgent=1)
|
||||
Cursor = lambda: Missing_Function
|
||||
|
||||
try:
|
||||
import pygame.sprite
|
||||
except (ImportError, IOError):
|
||||
sprite = MissingModule("sprite", urgent=1)
|
||||
|
||||
try:
|
||||
import pygame.threads
|
||||
except (ImportError, IOError):
|
||||
threads = MissingModule("threads", urgent=1)
|
||||
|
||||
try:
|
||||
import pygame.pixelcopy
|
||||
except (ImportError, IOError):
|
||||
pixelcopy = MissingModule("pixelcopy", urgent=1)
|
||||
|
||||
|
||||
def warn_unwanted_files():
|
||||
"""warn about unneeded old files"""
|
||||
|
||||
# a temporary hack to warn about camera.so and camera.pyd.
|
||||
install_path = os.path.split(pygame.base.__file__)[0]
|
||||
extension_ext = os.path.splitext(pygame.base.__file__)[1]
|
||||
|
||||
# here are the .so/.pyd files we need to ask to remove.
|
||||
ext_to_remove = ["camera"]
|
||||
|
||||
# here are the .py/.pyo/.pyc files we need to ask to remove.
|
||||
py_to_remove = ["color"]
|
||||
|
||||
# Don't warn on Symbian. The color.py is used as a wrapper.
|
||||
if os.name == "e32":
|
||||
py_to_remove = []
|
||||
|
||||
# See if any of the files are there.
|
||||
extension_files = [f"{x}{extension_ext}" for x in ext_to_remove]
|
||||
|
||||
py_files = [
|
||||
f"{x}{py_ext}" for py_ext in [".py", ".pyc", ".pyo"] for x in py_to_remove
|
||||
]
|
||||
|
||||
files = py_files + extension_files
|
||||
|
||||
unwanted_files = []
|
||||
for f in files:
|
||||
unwanted_files.append(os.path.join(install_path, f))
|
||||
|
||||
ask_remove = []
|
||||
for f in unwanted_files:
|
||||
if os.path.exists(f):
|
||||
ask_remove.append(f)
|
||||
|
||||
if ask_remove:
|
||||
message = "Detected old file(s). Please remove the old files:\n"
|
||||
message += " ".join(ask_remove)
|
||||
message += "\nLeaving them there might break pygame. Cheers!\n\n"
|
||||
|
||||
try:
|
||||
import warnings
|
||||
|
||||
level = 4
|
||||
warnings.warn(message, RuntimeWarning, level)
|
||||
except ImportError:
|
||||
print(message)
|
||||
|
||||
|
||||
# disable, because we hopefully don't need it.
|
||||
# warn_unwanted_files()
|
||||
|
||||
|
||||
try:
|
||||
from pygame.surface import Surface, SurfaceType
|
||||
except (ImportError, IOError):
|
||||
Surface = lambda: Missing_Function
|
||||
|
||||
try:
|
||||
import pygame.mask
|
||||
from pygame.mask import Mask
|
||||
except (ImportError, IOError):
|
||||
mask = MissingModule("mask", urgent=0)
|
||||
Mask = lambda: Missing_Function
|
||||
|
||||
try:
|
||||
from pygame.pixelarray import PixelArray
|
||||
except (ImportError, IOError):
|
||||
PixelArray = lambda: Missing_Function
|
||||
|
||||
try:
|
||||
from pygame.overlay import Overlay
|
||||
except (ImportError, IOError):
|
||||
Overlay = lambda: Missing_Function
|
||||
|
||||
try:
|
||||
import pygame.time
|
||||
except (ImportError, IOError):
|
||||
time = MissingModule("time", urgent=1)
|
||||
|
||||
try:
|
||||
import pygame.transform
|
||||
except (ImportError, IOError):
|
||||
transform = MissingModule("transform", urgent=1)
|
||||
|
||||
# lastly, the "optional" pygame modules
|
||||
if "PYGAME_FREETYPE" in os.environ:
|
||||
try:
|
||||
import pygame.ftfont as font
|
||||
|
||||
sys.modules["pygame.font"] = font
|
||||
except (ImportError, IOError):
|
||||
pass
|
||||
try:
|
||||
import pygame.font
|
||||
import pygame.sysfont
|
||||
|
||||
pygame.font.SysFont = pygame.sysfont.SysFont
|
||||
pygame.font.get_fonts = pygame.sysfont.get_fonts
|
||||
pygame.font.match_font = pygame.sysfont.match_font
|
||||
except (ImportError, IOError):
|
||||
font = MissingModule("font", urgent=0)
|
||||
|
||||
# try and load pygame.mixer_music before mixer, for py2app...
|
||||
try:
|
||||
import pygame.mixer_music
|
||||
|
||||
# del pygame.mixer_music
|
||||
# print ("NOTE2: failed importing pygame.mixer_music in lib/__init__.py")
|
||||
except (ImportError, IOError):
|
||||
pass
|
||||
|
||||
try:
|
||||
import pygame.mixer
|
||||
except (ImportError, IOError):
|
||||
mixer = MissingModule("mixer", urgent=0)
|
||||
|
||||
# always fails, but MissingModule needs an exception to process
|
||||
try:
|
||||
import pygame.movie
|
||||
except (ImportError, IOError):
|
||||
movie = MissingModule("movie", urgent=0)
|
||||
|
||||
try:
|
||||
import pygame.scrap
|
||||
except (ImportError, IOError):
|
||||
scrap = MissingModule("scrap", urgent=0)
|
||||
|
||||
try:
|
||||
import pygame.surfarray
|
||||
except (ImportError, IOError):
|
||||
surfarray = MissingModule("surfarray", urgent=0)
|
||||
|
||||
try:
|
||||
import pygame.sndarray
|
||||
except (ImportError, IOError):
|
||||
sndarray = MissingModule("sndarray", urgent=0)
|
||||
|
||||
try:
|
||||
import pygame.fastevent
|
||||
except (ImportError, IOError):
|
||||
fastevent = MissingModule("fastevent", urgent=0)
|
||||
|
||||
# there's also a couple "internal" modules not needed
|
||||
# by users, but putting them here helps "dependency finder"
|
||||
# programs get everything they need (like py2exe)
|
||||
try:
|
||||
import pygame.imageext
|
||||
|
||||
del pygame.imageext
|
||||
except (ImportError, IOError):
|
||||
pass
|
||||
|
||||
|
||||
def packager_imports():
|
||||
"""some additional imports that py2app/py2exe will want to see"""
|
||||
import atexit
|
||||
import numpy
|
||||
import OpenGL.GL
|
||||
import pygame.macosx
|
||||
import pygame.colordict
|
||||
|
||||
|
||||
# make Rects pickleable
|
||||
|
||||
import copyreg
|
||||
|
||||
|
||||
def __rect_constructor(x, y, w, h):
|
||||
return Rect(x, y, w, h)
|
||||
|
||||
|
||||
def __rect_reduce(r):
|
||||
assert isinstance(r, Rect)
|
||||
return __rect_constructor, (r.x, r.y, r.w, r.h)
|
||||
|
||||
|
||||
copyreg.pickle(Rect, __rect_reduce, __rect_constructor)
|
||||
|
||||
|
||||
# make Colors pickleable
|
||||
def __color_constructor(r, g, b, a):
|
||||
return Color(r, g, b, a)
|
||||
|
||||
|
||||
def __color_reduce(c):
|
||||
assert isinstance(c, Color)
|
||||
return __color_constructor, (c.r, c.g, c.b, c.a)
|
||||
|
||||
|
||||
copyreg.pickle(Color, __color_reduce, __color_constructor)
|
||||
|
||||
# Thanks for supporting pygame. Without support now, there won't be pygame later.
|
||||
if "PYGAME_HIDE_SUPPORT_PROMPT" not in os.environ:
|
||||
print(
|
||||
"pygame {} (SDL {}.{}.{}, Python {}.{}.{})".format( # pylint: disable=consider-using-f-string
|
||||
ver, *get_sdl_version() + sys.version_info[0:3]
|
||||
)
|
||||
)
|
||||
print("Hello from the pygame community. https://www.pygame.org/contribute.html")
|
||||
|
||||
# cleanup namespace
|
||||
del pygame, os, sys, MissingModule, copyreg
|
||||
74
.venv/lib/python3.8/site-packages/pygame/__init__.pyi
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
from typing import Any, Tuple, Callable, Optional, overload, Type
|
||||
|
||||
# Re-export modules as members; see PEP 484 for stub export rules.
|
||||
|
||||
# Most useful stuff
|
||||
from pygame.constants import *
|
||||
from pygame import surface as surface
|
||||
from pygame import rect as rect
|
||||
from pygame import color as color
|
||||
from pygame import event as event
|
||||
from pygame import draw as draw
|
||||
from pygame import display as display
|
||||
from pygame import font as font
|
||||
from pygame import image as image
|
||||
from pygame import key as key
|
||||
from pygame import mixer as mixer
|
||||
from pygame import mouse as mouse
|
||||
from pygame import time as time
|
||||
from pygame import version as version
|
||||
|
||||
# Advanced stuff
|
||||
from pygame import cursors as cursors
|
||||
from pygame import joystick as joystick
|
||||
from pygame import mask as mask
|
||||
from pygame import sprite as sprite
|
||||
from pygame import transform as transform
|
||||
from pygame import bufferproxy as bufferproxy
|
||||
from pygame import pixelarray as pixelarray
|
||||
from pygame import pixelcopy as pixelcopy
|
||||
from pygame import sndarray as sndarray
|
||||
from pygame import surfarray as surfarray
|
||||
from pygame import math as math
|
||||
from pygame import fastevent as fastevent
|
||||
|
||||
# Other
|
||||
from pygame import scrap as scrap
|
||||
|
||||
from ._common import _AnyPath
|
||||
|
||||
# These classes are auto imported with pygame, so I put their declaration here
|
||||
class Rect(rect.Rect): ...
|
||||
class Surface(surface.Surface): ...
|
||||
class Color(color.Color): ...
|
||||
class PixelArray(pixelarray.PixelArray): ...
|
||||
class Vector2(math.Vector2): ...
|
||||
class Vector3(math.Vector3): ...
|
||||
class Cursor(cursors.Cursor): ...
|
||||
|
||||
def init() -> Tuple[int, int]: ...
|
||||
def quit() -> None: ...
|
||||
def get_init() -> bool: ...
|
||||
|
||||
class error(RuntimeError): ...
|
||||
|
||||
def get_error() -> str: ...
|
||||
def set_error(error_msg: str) -> None: ...
|
||||
def get_sdl_version() -> Tuple[int, int, int]: ...
|
||||
def get_sdl_byteorder() -> int: ...
|
||||
def encode_string(
|
||||
obj: Optional[_AnyPath],
|
||||
encoding: Optional[str] = "unicode_escape",
|
||||
errors: Optional[str] = "backslashreplace",
|
||||
etype: Optional[Type[Exception]] = UnicodeEncodeError,
|
||||
) -> bytes: ...
|
||||
@overload
|
||||
def encode_file_path(
|
||||
obj: Optional[_AnyPath], etype: Optional[Type[Exception]] = UnicodeEncodeError
|
||||
) -> bytes: ...
|
||||
@overload
|
||||
def encode_file_path(
|
||||
obj: Any, etype: Optional[Type[Exception]] = UnicodeEncodeError
|
||||
) -> bytes: ...
|
||||
def register_quit(callable: Callable[[], Any]) -> None: ...
|
||||
def __getattr__(name: str) -> Any: ... # don't error on missing stubs
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
import os
|
||||
|
||||
|
||||
def get_hook_dirs():
|
||||
return [os.path.dirname(__file__)]
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
"""
|
||||
binaries hook for pygame seems to be required for pygame 2.0 Windows.
|
||||
Otherwise some essential DLLs will not be transfered to the exe.
|
||||
|
||||
And also put hooks for datas, resources that pygame uses, to work
|
||||
correctly with pyinstaller
|
||||
"""
|
||||
|
||||
import os
|
||||
import platform
|
||||
|
||||
from pygame import __file__ as pygame_main_file
|
||||
|
||||
# Get pygame's folder
|
||||
pygame_folder = os.path.dirname(os.path.abspath(pygame_main_file))
|
||||
|
||||
# datas is the variable that pyinstaller looks for while processing hooks
|
||||
datas = []
|
||||
|
||||
# A helper to append the relative path of a resource to hook variable - datas
|
||||
def _append_to_datas(file_path):
|
||||
res_path = os.path.join(pygame_folder, file_path)
|
||||
if os.path.exists(res_path):
|
||||
datas.append((res_path, "pygame"))
|
||||
|
||||
|
||||
# First append the font file, then based on the OS, append pygame icon file
|
||||
_append_to_datas("freesansbold.ttf")
|
||||
if platform.system() == "Darwin":
|
||||
_append_to_datas("pygame_icon_mac.bmp")
|
||||
else:
|
||||
_append_to_datas("pygame_icon.bmp")
|
||||
|
||||
if platform.system() == "Windows":
|
||||
from PyInstaller.utils.hooks import collect_dynamic_libs
|
||||
|
||||
pre_binaries = collect_dynamic_libs("pygame")
|
||||
binaries = []
|
||||
|
||||
for b in pre_binaries:
|
||||
binary, location = b
|
||||
# settles all the DLLs into the top level folder, which prevents duplication
|
||||
# with the DLLs already being put there.
|
||||
binaries.append((binary, "."))
|
||||
BIN
.venv/lib/python3.8/site-packages/pygame/_camera.cpython-38-x86_64-linux-gnu.so
Executable file
174
.venv/lib/python3.8/site-packages/pygame/_camera_opencv.py
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
import numpy
|
||||
import cv2
|
||||
import time
|
||||
|
||||
import pygame
|
||||
|
||||
|
||||
def list_cameras():
|
||||
return [0]
|
||||
|
||||
|
||||
def list_cameras_darwin():
|
||||
import subprocess
|
||||
from xml.etree import ElementTree
|
||||
|
||||
# pylint: disable=consider-using-with
|
||||
flout, _ = subprocess.Popen(
|
||||
"system_profiler -xml SPCameraDataType",
|
||||
shell=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
).communicate()
|
||||
|
||||
last_text = None
|
||||
cameras = []
|
||||
|
||||
for node in ElementTree.fromstring(flout).iterfind("./array/dict/array/dict/*"):
|
||||
if last_text == "_name":
|
||||
cameras.append(node.text)
|
||||
last_text = node.text
|
||||
|
||||
return cameras
|
||||
|
||||
|
||||
class Camera(object):
|
||||
def __init__(self, device=0, size=(640, 480), mode="RGB"):
|
||||
self._device_index = device
|
||||
self._size = size
|
||||
|
||||
if mode == "RGB":
|
||||
self._fmt = cv2.COLOR_BGR2RGB
|
||||
elif mode == "YUV":
|
||||
self._fmt = cv2.COLOR_BGR2YUV
|
||||
elif mode == "HSV":
|
||||
self._fmt = cv2.COLOR_BGR2HSV
|
||||
else:
|
||||
raise ValueError("Not a supported mode")
|
||||
|
||||
self._open = False
|
||||
|
||||
# all of this could have been done in the constructor, but creating
|
||||
# the VideoCapture is very time consuming, so it makes more sense in the
|
||||
# actual start() method
|
||||
def start(self):
|
||||
if self._open:
|
||||
return
|
||||
|
||||
self._cam = cv2.VideoCapture(self._device_index)
|
||||
|
||||
if not self._cam.isOpened():
|
||||
raise ValueError("Could not open camera.")
|
||||
|
||||
self._cam.set(cv2.CAP_PROP_FRAME_WIDTH, self._size[0])
|
||||
self._cam.set(cv2.CAP_PROP_FRAME_HEIGHT, self._size[1])
|
||||
|
||||
w = self._cam.get(cv2.CAP_PROP_FRAME_WIDTH)
|
||||
h = self._cam.get(cv2.CAP_PROP_FRAME_HEIGHT)
|
||||
self._size = (int(w), int(h))
|
||||
|
||||
self._flipx = False
|
||||
self._flipy = False
|
||||
self._brightness = 1
|
||||
|
||||
self._frametime = 1 / self._cam.get(cv2.CAP_PROP_FPS)
|
||||
self._last_frame_time = 0
|
||||
|
||||
self._open = True
|
||||
|
||||
def stop(self):
|
||||
if self._open:
|
||||
self._cam.release()
|
||||
self._cam = None
|
||||
self._open = False
|
||||
|
||||
def _check_open(self):
|
||||
if not self._open:
|
||||
raise pygame.error("Camera must be started")
|
||||
|
||||
def get_size(self):
|
||||
self._check_open()
|
||||
|
||||
return self._size
|
||||
|
||||
def set_controls(self, hflip=None, vflip=None, brightness=None):
|
||||
self._check_open()
|
||||
|
||||
if hflip is not None:
|
||||
self._flipx = bool(hflip)
|
||||
if vflip is not None:
|
||||
self._flipy = bool(vflip)
|
||||
if brightness is not None:
|
||||
self._cam.set(cv2.CAP_PROP_BRIGHTNESS, brightness)
|
||||
|
||||
return self.get_controls()
|
||||
|
||||
def get_controls(self):
|
||||
self._check_open()
|
||||
|
||||
return (self._flipx, self._flipy, self._cam.get(cv2.CAP_PROP_BRIGHTNESS))
|
||||
|
||||
def query_image(self):
|
||||
self._check_open()
|
||||
|
||||
current_time = time.time()
|
||||
if current_time - self._last_frame_time > self._frametime:
|
||||
return True
|
||||
return False
|
||||
|
||||
def get_image(self, dest_surf=None):
|
||||
self._check_open()
|
||||
|
||||
self._last_frame_time = time.time()
|
||||
|
||||
_, image = self._cam.read()
|
||||
|
||||
image = cv2.cvtColor(image, self._fmt)
|
||||
|
||||
flip_code = None
|
||||
if self._flipx:
|
||||
if self._flipy:
|
||||
flip_code = -1
|
||||
else:
|
||||
flip_code = 1
|
||||
elif self._flipy:
|
||||
flip_code = 0
|
||||
|
||||
if flip_code is not None:
|
||||
image = cv2.flip(image, flip_code)
|
||||
|
||||
image = numpy.fliplr(image)
|
||||
image = numpy.rot90(image)
|
||||
|
||||
surf = pygame.surfarray.make_surface(image)
|
||||
|
||||
if dest_surf:
|
||||
dest_surf.blit(surf, (0, 0))
|
||||
return dest_surf
|
||||
|
||||
return surf
|
||||
|
||||
def get_raw(self):
|
||||
self._check_open()
|
||||
|
||||
self._last_frame_time = time.time()
|
||||
|
||||
_, image = self._cam.read()
|
||||
|
||||
return image.tobytes()
|
||||
|
||||
|
||||
class CameraMac(Camera):
|
||||
def __init__(self, device=0, size=(640, 480), mode="RGB"):
|
||||
|
||||
if isinstance(device, int):
|
||||
_dev = device
|
||||
elif isinstance(device, str):
|
||||
_dev = list_cameras_darwin().index(device)
|
||||
else:
|
||||
raise TypeError(
|
||||
"OpenCV-Mac backend can take device indices or names, ints or strings, not ",
|
||||
str(type(device)),
|
||||
)
|
||||
|
||||
super().__init__(_dev, size, mode)
|
||||
117
.venv/lib/python3.8/site-packages/pygame/_camera_vidcapture.py
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
"""pygame.camera.Camera implementation using the videocapture module for windows.
|
||||
|
||||
http://videocapture.sourceforge.net/
|
||||
|
||||
Binary windows wheels:
|
||||
https://www.lfd.uci.edu/~gohlke/pythonlibs/#videocapture
|
||||
"""
|
||||
import pygame
|
||||
|
||||
|
||||
def list_cameras():
|
||||
"""Always only lists one camera.
|
||||
|
||||
Functionality not supported in videocapture module.
|
||||
"""
|
||||
return [0]
|
||||
|
||||
# this just cycles through all the cameras trying to open them
|
||||
# cameras = []
|
||||
# for x in range(256):
|
||||
# try:
|
||||
# c = Camera(x)
|
||||
# except:
|
||||
# break
|
||||
# cameras.append(x)
|
||||
# return cameras
|
||||
|
||||
|
||||
def init():
|
||||
global vidcap
|
||||
try:
|
||||
import vidcap as vc
|
||||
except ImportError:
|
||||
from VideoCapture import vidcap as vc
|
||||
vidcap = vc
|
||||
|
||||
|
||||
def quit():
|
||||
global vidcap
|
||||
vidcap = None
|
||||
|
||||
|
||||
class Camera:
|
||||
# pylint: disable=unused-argument
|
||||
def __init__(self, device=0, size=(640, 480), mode="RGB", show_video_window=0):
|
||||
"""device: VideoCapture enumerates the available video capture devices
|
||||
on your system. If you have more than one device, specify
|
||||
the desired one here. The device number starts from 0.
|
||||
|
||||
show_video_window: 0 ... do not display a video window (the default)
|
||||
1 ... display a video window
|
||||
|
||||
Mainly used for debugging, since the video window
|
||||
can not be closed or moved around.
|
||||
"""
|
||||
self.dev = vidcap.new_Dev(device, show_video_window)
|
||||
width, height = size
|
||||
self.dev.setresolution(width, height)
|
||||
|
||||
def display_capture_filter_properties(self):
|
||||
"""Displays a dialog containing the property page of the capture filter.
|
||||
|
||||
For VfW drivers you may find the option to select the resolution most
|
||||
likely here.
|
||||
"""
|
||||
self.dev.displaycapturefilterproperties()
|
||||
|
||||
def display_capture_pin_properties(self):
|
||||
"""Displays a dialog containing the property page of the capture pin.
|
||||
|
||||
For WDM drivers you may find the option to select the resolution most
|
||||
likely here.
|
||||
"""
|
||||
self.dev.displaycapturepinproperties()
|
||||
|
||||
def set_resolution(self, width, height):
|
||||
"""Sets the capture resolution. (without dialog)"""
|
||||
self.dev.setresolution(width, height)
|
||||
|
||||
def get_buffer(self):
|
||||
"""Returns a string containing the raw pixel data."""
|
||||
return self.dev.getbuffer()
|
||||
|
||||
def start(self):
|
||||
"""Not implemented."""
|
||||
|
||||
def set_controls(self, **kwargs):
|
||||
"""Not implemented."""
|
||||
|
||||
def stop(self):
|
||||
"""Not implemented."""
|
||||
|
||||
def get_image(self, dest_surf=None):
|
||||
""" """
|
||||
return self.get_surface(dest_surf)
|
||||
|
||||
def get_surface(self, dest_surf=None):
|
||||
"""Returns a pygame Surface."""
|
||||
abuffer, width, height = self.get_buffer()
|
||||
if not abuffer:
|
||||
return None
|
||||
surf = pygame.image.frombuffer(abuffer, (width, height), "BGR")
|
||||
surf = pygame.transform.flip(surf, 0, 1)
|
||||
# if there is a destination surface given, we blit onto that.
|
||||
if dest_surf:
|
||||
dest_surf.blit(surf, (0, 0))
|
||||
else:
|
||||
dest_surf = surf
|
||||
return dest_surf
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import pygame.examples.camera
|
||||
|
||||
pygame.camera.Camera = Camera
|
||||
pygame.camera.list_cameras = list_cameras
|
||||
pygame.examples.camera.main()
|
||||
34
.venv/lib/python3.8/site-packages/pygame/_common.pyi
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
from os import PathLike
|
||||
from typing import IO, List, Sequence, Tuple, Union
|
||||
|
||||
from typing_extensions import Protocol
|
||||
|
||||
from pygame.color import Color
|
||||
from pygame.math import Vector2
|
||||
from pygame.rect import Rect
|
||||
|
||||
# For functions that take a file name
|
||||
_AnyPath = Union[str, bytes, PathLike[str], PathLike[bytes]]
|
||||
|
||||
# Most pygame functions that take a file argument should be able to handle
|
||||
# a _FileArg type
|
||||
_FileArg = Union[_AnyPath, IO[bytes], IO[str]]
|
||||
|
||||
_Coordinate = Union[Tuple[float, float], Sequence[float], Vector2]
|
||||
|
||||
# This typehint is used when a function would return an RGBA tuble
|
||||
_RgbaOutput = Tuple[int, int, int, int]
|
||||
_ColorValue = Union[Color, int, str, Tuple[int, int, int], List[int], _RgbaOutput]
|
||||
|
||||
_CanBeRect = Union[
|
||||
Rect,
|
||||
Tuple[int, int, int, int],
|
||||
List[int],
|
||||
Tuple[_Coordinate, _Coordinate],
|
||||
List[_Coordinate],
|
||||
]
|
||||
|
||||
class _HasRectAttribute(Protocol):
|
||||
rect: _CanBeRect
|
||||
|
||||
_RectValue = Union[_CanBeRect, _HasRectAttribute]
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
from .sdl2 import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
|
||||
from .audio import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
|
||||
from .video import * # pylint: disable=wildcard-import; lgtm[py/polluting-import]
|
||||
|
|
@ -0,0 +1 @@
|
|||
from pygame._sdl2.video import *
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
from typing import Dict, Mapping, Optional
|
||||
|
||||
from pygame.joystick import Joystick
|
||||
|
||||
def init() -> None: ...
|
||||
def get_init() -> bool: ...
|
||||
def quit() -> None: ...
|
||||
def set_eventstate(state: bool) -> None: ...
|
||||
def get_eventstate() -> bool: ...
|
||||
def get_count() -> int: ...
|
||||
def is_controller(index: int) -> bool: ...
|
||||
def name_forindex(index: int) -> Optional[str]: ...
|
||||
|
||||
class Controller:
|
||||
def __init__(self, index: int) -> None: ...
|
||||
def init(self) -> None: ...
|
||||
def get_init(self) -> bool: ...
|
||||
def quit(self) -> None: ...
|
||||
@staticmethod
|
||||
def from_joystick(joy: Joystick) -> Controller: ...
|
||||
def attached(self) -> bool: ...
|
||||
def as_joystick(self) -> Joystick: ...
|
||||
def get_axis(self, axis: int) -> int: ...
|
||||
def get_button(self, button: int) -> bool: ...
|
||||
def get_mapping(self) -> Dict[str, str]: ...
|
||||
def set_mapping(self, mapping: Mapping[str, str]) -> int: ...
|
||||
def rumble(
|
||||
self, low_frequency: float, high_frequency: float, duration: int
|
||||
) -> bool: ...
|
||||
def stop_rumble(self) -> None: ...
|
||||
6
.venv/lib/python3.8/site-packages/pygame/_sdl2/touch.pyi
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
from typing import Dict, Union
|
||||
|
||||
def get_num_devices() -> int: ...
|
||||
def get_device(index: int) -> int: ...
|
||||
def get_num_fingers(device_id: int) -> int: ...
|
||||
def get_finger(touchid: int, index: int) -> Dict[str, Union[int, float]]: ...
|
||||
154
.venv/lib/python3.8/site-packages/pygame/_sdl2/video.pyi
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
from typing import Any, Generator, Iterable, Optional, Tuple, Union
|
||||
|
||||
from pygame.color import Color
|
||||
from pygame.rect import Rect
|
||||
from pygame.surface import Surface
|
||||
|
||||
from .._common import _CanBeRect
|
||||
|
||||
WINDOWPOS_UNDEFINED: int
|
||||
WINDOWPOS_CENTERED: int
|
||||
|
||||
MESSAGEBOX_ERROR: int
|
||||
MESSAGEBOX_WARNING: int
|
||||
MESSAGEBOX_INFORMATION: int
|
||||
|
||||
class RendererDriverInfo:
|
||||
name: str
|
||||
flags: int
|
||||
num_texture_formats: int
|
||||
max_texture_width: int
|
||||
max_texture_height: int
|
||||
|
||||
def get_drivers() -> Generator[RendererDriverInfo, None, None]: ...
|
||||
def get_grabbed_window() -> Optional[Window]: ...
|
||||
def messagebox(
|
||||
title: str,
|
||||
message: str,
|
||||
window: Optional[Window] = None,
|
||||
info: bool = False,
|
||||
warn: bool = False,
|
||||
error: bool = False,
|
||||
buttons: Tuple[str, ...] = ("OK",),
|
||||
return_button: int = 0,
|
||||
escape_button: int = 0,
|
||||
) -> int: ...
|
||||
|
||||
class Window:
|
||||
def __init__(
|
||||
self,
|
||||
title: str = "pygame",
|
||||
size: Iterable[int] = (640, 480),
|
||||
position: Optional[Iterable[int]] = None,
|
||||
fullscreen: bool = False,
|
||||
fullscreen_desktop: bool = False,
|
||||
**kwargs: bool
|
||||
) -> None: ...
|
||||
@staticmethod
|
||||
def from_display_module() -> Window: ...
|
||||
grab: bool
|
||||
relative_mouse: bool
|
||||
def set_windowed(self) -> None: ...
|
||||
def set_fullscreen(self, desktop: bool = False) -> None: ...
|
||||
title: str
|
||||
def destroy(self) -> None: ...
|
||||
def hide(self) -> None: ...
|
||||
def show(self) -> None: ...
|
||||
def focus(self, input_only: bool = False) -> None: ...
|
||||
def restore(self) -> None: ...
|
||||
def maximize(self) -> None: ...
|
||||
def minimize(self) -> None: ...
|
||||
resizable: bool
|
||||
borderless: bool
|
||||
def set_icon(self, surface: Surface) -> None: ...
|
||||
id: int
|
||||
size: Iterable[int]
|
||||
position: Union[int, Iterable[int]]
|
||||
opacity: float
|
||||
brightness: float
|
||||
display_index: int
|
||||
def set_modal_for(self, Window) -> None: ...
|
||||
|
||||
class Texture:
|
||||
def __init__(
|
||||
self,
|
||||
renderer: Renderer,
|
||||
size: Iterable[int],
|
||||
static: bool = False,
|
||||
streaming: bool = False,
|
||||
target: bool = False,
|
||||
) -> None: ...
|
||||
@staticmethod
|
||||
def from_surface(renderer: Renderer, surface: Surface) -> Texture: ...
|
||||
renderer: Renderer
|
||||
width: int
|
||||
height: int
|
||||
alpha: int
|
||||
blend_mode: int
|
||||
color: Color
|
||||
def get_rect(self, **kwargs: Any) -> Rect: ...
|
||||
def draw(
|
||||
self,
|
||||
srcrect: Optional[_CanBeRect] = None,
|
||||
dstrect: Optional[Union[_CanBeRect, Iterable[int]]] = None,
|
||||
angle: int = 0,
|
||||
origin: Optional[Iterable[int]] = None,
|
||||
flipX: bool = False,
|
||||
flipY: bool = False,
|
||||
) -> None: ...
|
||||
def update(self, surface: Surface, area: Optional[_CanBeRect] = None) -> None: ...
|
||||
|
||||
class Image:
|
||||
def __init__(
|
||||
self,
|
||||
textureOrImage: Union[Texture, Image],
|
||||
srcrect: Optional[_CanBeRect] = None,
|
||||
) -> None: ...
|
||||
def get_rect(self, **kwargs: Any) -> Rect: ...
|
||||
def draw(
|
||||
self, srcrect: Optional[_CanBeRect] = None, dstrect: Optional[_CanBeRect] = None
|
||||
) -> None: ...
|
||||
angle: float
|
||||
origin: Optional[Iterable[float]]
|
||||
flipX: bool
|
||||
flipY: bool
|
||||
color: Color
|
||||
alpha: float
|
||||
blend_mode: int
|
||||
texture: Texture
|
||||
srcrect: Rect
|
||||
|
||||
class Renderer:
|
||||
def __init__(
|
||||
self,
|
||||
window: Window,
|
||||
index: int = -1,
|
||||
accelerated: int = -1,
|
||||
vsync: bool = False,
|
||||
target_texture: bool = False,
|
||||
) -> None: ...
|
||||
@staticmethod
|
||||
def from_window(window: Window) -> Renderer: ...
|
||||
draw_blend_mode: int
|
||||
draw_color: Color
|
||||
def clear(self) -> None: ...
|
||||
def present(self) -> None: ...
|
||||
def get_viewport(self) -> Rect: ...
|
||||
def set_viewport(self, area: Optional[_CanBeRect]) -> None: ...
|
||||
logical_size: Iterable[int]
|
||||
scale: Iterable[float]
|
||||
target: Union[Texture, None]
|
||||
def blit(
|
||||
self,
|
||||
source: Union[Texture, Image],
|
||||
dest: Optional[_CanBeRect] = None,
|
||||
area: Optional[_CanBeRect] = None,
|
||||
special_flags: int = 0,
|
||||
) -> Rect: ...
|
||||
def draw_line(self, p1: Iterable[int], p2: Iterable[int]) -> None: ...
|
||||
def draw_point(self, point: Iterable[int]) -> None: ...
|
||||
def draw_rect(self, rect: _CanBeRect) -> None: ...
|
||||
def fill_rect(self, rect: _CanBeRect) -> None: ...
|
||||
def to_surface(
|
||||
self, surface: Optional[Surface] = None, area: Optional[_CanBeRect] = None
|
||||
) -> Surface: ...
|
||||
BIN
.venv/lib/python3.8/site-packages/pygame/_sprite.cpython-38-x86_64-linux-gnu.so
Executable file
BIN
.venv/lib/python3.8/site-packages/pygame/base.cpython-38-x86_64-linux-gnu.so
Executable file
10
.venv/lib/python3.8/site-packages/pygame/bufferproxy.pyi
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
from typing import Any, overload
|
||||
|
||||
class BufferProxy(object):
|
||||
parent: Any
|
||||
length: int
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def __init__(self, parent: Any) -> None: ...
|
||||
def write(self, buffer: bytes, offset: int = 0) -> None: ...
|
||||
194
.venv/lib/python3.8/site-packages/pygame/camera.py
Normal file
|
|
@ -0,0 +1,194 @@
|
|||
import os
|
||||
import sys
|
||||
import platform
|
||||
import warnings
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
_is_init = 0
|
||||
|
||||
|
||||
def _setup_opencv_mac():
|
||||
global list_cameras, Camera, colorspace
|
||||
|
||||
from pygame import _camera_opencv
|
||||
|
||||
try:
|
||||
from pygame import _camera
|
||||
except ImportError:
|
||||
_camera = None
|
||||
|
||||
list_cameras = _camera_opencv.list_cameras_darwin
|
||||
Camera = _camera_opencv.CameraMac
|
||||
if _camera:
|
||||
colorspace = _camera.colorspace
|
||||
|
||||
|
||||
def _setup_opencv():
|
||||
global list_cameras, Camera, colorspace
|
||||
|
||||
from pygame import _camera_opencv
|
||||
|
||||
try:
|
||||
from pygame import _camera
|
||||
except ImportError:
|
||||
_camera = None
|
||||
|
||||
list_cameras = _camera_opencv.list_cameras
|
||||
Camera = _camera_opencv.Camera
|
||||
if _camera:
|
||||
colorspace = _camera.colorspace
|
||||
|
||||
|
||||
def _setup__camera():
|
||||
global list_cameras, Camera, colorspace
|
||||
|
||||
from pygame import _camera
|
||||
|
||||
list_cameras = _camera.list_cameras
|
||||
Camera = _camera.Camera
|
||||
colorspace = _camera.colorspace
|
||||
|
||||
|
||||
def _setup_vidcapture():
|
||||
global list_cameras, Camera, colorspace
|
||||
|
||||
from pygame import _camera_vidcapture
|
||||
|
||||
try:
|
||||
from pygame import _camera
|
||||
except ImportError:
|
||||
_camera = None
|
||||
|
||||
warnings.warn(
|
||||
"The VideoCapture backend is not recommended and may be removed."
|
||||
"For Python3 and Windows 8+, there is now a native Windows backend built into pygame.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
_camera_vidcapture.init()
|
||||
list_cameras = _camera_vidcapture.list_cameras
|
||||
Camera = _camera_vidcapture.Camera
|
||||
if _camera:
|
||||
colorspace = _camera.colorspace
|
||||
|
||||
|
||||
def get_backends():
|
||||
possible_backends = []
|
||||
|
||||
if sys.platform == "win32" and int(platform.win32_ver()[0]) > 8:
|
||||
possible_backends.append("_camera (MSMF)")
|
||||
|
||||
if "linux" in sys.platform:
|
||||
possible_backends.append("_camera (V4L2)")
|
||||
|
||||
if "darwin" in sys.platform:
|
||||
possible_backends.append("OpenCV-Mac")
|
||||
|
||||
possible_backends.append("OpenCV")
|
||||
|
||||
if sys.platform == "win32":
|
||||
possible_backends.append("VidCapture")
|
||||
|
||||
# see if we have any user specified defaults in environments.
|
||||
camera_env = os.environ.get("PYGAME_CAMERA", "")
|
||||
if camera_env == "opencv": # prioritize opencv
|
||||
if "OpenCV" in possible_backends:
|
||||
possible_backends.remove("OpenCV")
|
||||
possible_backends = ["OpenCV"] + possible_backends
|
||||
if camera_env == "vidcapture": # prioritize vidcapture
|
||||
if "VideoCapture" in possible_backends:
|
||||
possible_backends.remove("VideoCapture")
|
||||
possible_backends = ["VideoCapture"] + possible_backends
|
||||
|
||||
return possible_backends
|
||||
|
||||
|
||||
backend_table = {
|
||||
"opencv-mac": _setup_opencv_mac,
|
||||
"opencv": _setup_opencv,
|
||||
"_camera (msmf)": _setup__camera,
|
||||
"_camera (v4l2)": _setup__camera,
|
||||
"videocapture": _setup_vidcapture,
|
||||
}
|
||||
|
||||
|
||||
def init(backend=None):
|
||||
global _is_init
|
||||
# select the camera module to import here.
|
||||
|
||||
backends = get_backends()
|
||||
|
||||
if not backends:
|
||||
_is_init = 1
|
||||
return
|
||||
|
||||
backends = [b.lower() for b in backends]
|
||||
|
||||
if not backend:
|
||||
backend = backends[0]
|
||||
else:
|
||||
backend = backend.lower()
|
||||
|
||||
if backend not in backend_table:
|
||||
raise ValueError("unrecognized backend name")
|
||||
|
||||
if backend not in backends:
|
||||
warnings.warn(
|
||||
"We don't think this is a supported backend on this system, but we'll try it...",
|
||||
Warning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
backend_table[backend]()
|
||||
|
||||
_is_init = 1
|
||||
|
||||
|
||||
def quit():
|
||||
global _is_init
|
||||
_is_init = 0
|
||||
|
||||
|
||||
class AbstractCamera(ABC):
|
||||
@abstractmethod
|
||||
def __init__(self, device=0, size=(320, 200), mode="RGB"):
|
||||
""" """
|
||||
|
||||
@abstractmethod
|
||||
def set_resolution(self, width, height):
|
||||
"""Sets the capture resolution. (without dialog)"""
|
||||
|
||||
@abstractmethod
|
||||
def start(self):
|
||||
""" """
|
||||
|
||||
@abstractmethod
|
||||
def stop(self):
|
||||
""" """
|
||||
|
||||
@abstractmethod
|
||||
def get_buffer(self):
|
||||
""" """
|
||||
|
||||
@abstractmethod
|
||||
def set_controls(self, **kwargs):
|
||||
""" """
|
||||
|
||||
@abstractmethod
|
||||
def get_image(self, dest_surf=None):
|
||||
""" """
|
||||
|
||||
@abstractmethod
|
||||
def get_surface(self, dest_surf=None):
|
||||
""" """
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# try and use this camera stuff with the pygame camera example.
|
||||
import pygame.examples.camera
|
||||
|
||||
# pygame.camera.Camera = Camera
|
||||
# pygame.camera.list_cameras = list_cameras
|
||||
pygame.examples.camera.main()
|
||||
29
.venv/lib/python3.8/site-packages/pygame/camera.pyi
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
from typing import List, Optional, Tuple, Union
|
||||
|
||||
from pygame.surface import Surface
|
||||
|
||||
def get_backends() -> List[str]: ...
|
||||
def init(backend: Optional[str]) -> None: ...
|
||||
def quit() -> None: ...
|
||||
def list_cameras() -> List[str]: ...
|
||||
|
||||
class Camera:
|
||||
def __init__(
|
||||
self,
|
||||
device: str,
|
||||
size: Union[Tuple[int, int], List[int]] = (640, 480),
|
||||
format: str = "RGB",
|
||||
) -> None: ...
|
||||
def start(self) -> None: ...
|
||||
def stop(self) -> None: ...
|
||||
def get_controls(self) -> Tuple[bool, bool, int]: ...
|
||||
def set_controls(
|
||||
self,
|
||||
hflip: bool = ...,
|
||||
vflip: bool = ...,
|
||||
brightness: int = ...,
|
||||
) -> Tuple[bool, bool, int]: ...
|
||||
def get_size(self) -> Tuple[int, int]: ...
|
||||
def query_image(self) -> bool: ...
|
||||
def get_image(self, surface: Optional[Surface] = None) -> Surface: ...
|
||||
def get_raw(self) -> bytes: ...
|
||||
BIN
.venv/lib/python3.8/site-packages/pygame/color.cpython-38-x86_64-linux-gnu.so
Executable file
40
.venv/lib/python3.8/site-packages/pygame/color.pyi
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
from typing import Tuple, overload
|
||||
|
||||
from ._common import _ColorValue
|
||||
|
||||
class Color:
|
||||
r: int
|
||||
g: int
|
||||
b: int
|
||||
a: int
|
||||
cmy: Tuple[float, float, float]
|
||||
hsva: Tuple[float, float, float, float]
|
||||
hsla: Tuple[float, float, float, float]
|
||||
i1i2i3: Tuple[float, float, float]
|
||||
__hash__: None # type: ignore
|
||||
@overload
|
||||
def __init__(self, r: int, g: int, b: int, a: int = 255) -> None: ...
|
||||
@overload
|
||||
def __init__(self, rgbvalue: _ColorValue) -> None: ...
|
||||
@overload
|
||||
def __getitem__(self, i: int) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> Tuple[int]: ...
|
||||
def __setitem__(self, key: int, value: int) -> None: ...
|
||||
def __add__(self, other: Color) -> Color: ...
|
||||
def __sub__(self, other: Color) -> Color: ...
|
||||
def __mul__(self, other: Color) -> Color: ...
|
||||
def __floordiv__(self, other: Color) -> Color: ...
|
||||
def __mod__(self, other: Color) -> Color: ...
|
||||
def __int__(self) -> int: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __len__(self) -> int: ...
|
||||
def normalize(self) -> Tuple[float, float, float, float]: ...
|
||||
def correct_gamma(self, gamma: float) -> Color: ...
|
||||
def set_length(self, length: int) -> None: ...
|
||||
def lerp(self, color: _ColorValue, amount: float) -> Color: ...
|
||||
def premul_alpha(self) -> Color: ...
|
||||
@overload
|
||||
def update(self, r: int, g: int, b: int, a: int = 255) -> None: ...
|
||||
@overload
|
||||
def update(self, rgbvalue: _ColorValue) -> None: ...
|
||||
692
.venv/lib/python3.8/site-packages/pygame/colordict.py
Normal file
|
|
@ -0,0 +1,692 @@
|
|||
# pygame - Python Game Library
|
||||
# Copyright (C) 2000-2003 Pete Shinners
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Pete Shinners
|
||||
# pete@shinners.org
|
||||
|
||||
""" A dictionary of RGBA tuples indexed by color names.
|
||||
|
||||
See https://www.pygame.org/docs/ref/color_list.html for sample swatches.
|
||||
"""
|
||||
|
||||
THECOLORS = {
|
||||
"aliceblue": (240, 248, 255, 255),
|
||||
"antiquewhite": (250, 235, 215, 255),
|
||||
"antiquewhite1": (255, 239, 219, 255),
|
||||
"antiquewhite2": (238, 223, 204, 255),
|
||||
"antiquewhite3": (205, 192, 176, 255),
|
||||
"antiquewhite4": (139, 131, 120, 255),
|
||||
"aqua": (0, 255, 255, 255),
|
||||
"aquamarine": (127, 255, 212, 255),
|
||||
"aquamarine1": (127, 255, 212, 255),
|
||||
"aquamarine2": (118, 238, 198, 255),
|
||||
"aquamarine3": (102, 205, 170, 255),
|
||||
"aquamarine4": (69, 139, 116, 255),
|
||||
"azure": (240, 255, 255, 255),
|
||||
"azure1": (240, 255, 255, 255),
|
||||
"azure3": (193, 205, 205, 255),
|
||||
"azure2": (224, 238, 238, 255),
|
||||
"azure4": (131, 139, 139, 255),
|
||||
"beige": (245, 245, 220, 255),
|
||||
"bisque": (255, 228, 196, 255),
|
||||
"bisque1": (255, 228, 196, 255),
|
||||
"bisque2": (238, 213, 183, 255),
|
||||
"bisque3": (205, 183, 158, 255),
|
||||
"bisque4": (139, 125, 107, 255),
|
||||
"black": (0, 0, 0, 255),
|
||||
"blanchedalmond": (255, 235, 205, 255),
|
||||
"blue": (0, 0, 255, 255),
|
||||
"blue1": (0, 0, 255, 255),
|
||||
"blue2": (0, 0, 238, 255),
|
||||
"blue3": (0, 0, 205, 255),
|
||||
"blue4": (0, 0, 139, 255),
|
||||
"blueviolet": (138, 43, 226, 255),
|
||||
"brown": (165, 42, 42, 255),
|
||||
"brown1": (255, 64, 64, 255),
|
||||
"brown2": (238, 59, 59, 255),
|
||||
"brown3": (205, 51, 51, 255),
|
||||
"brown4": (139, 35, 35, 255),
|
||||
"burlywood": (222, 184, 135, 255),
|
||||
"burlywood1": (255, 211, 155, 255),
|
||||
"burlywood2": (238, 197, 145, 255),
|
||||
"burlywood3": (205, 170, 125, 255),
|
||||
"burlywood4": (139, 115, 85, 255),
|
||||
"cadetblue": (95, 158, 160, 255),
|
||||
"cadetblue1": (152, 245, 255, 255),
|
||||
"cadetblue2": (142, 229, 238, 255),
|
||||
"cadetblue3": (122, 197, 205, 255),
|
||||
"cadetblue4": (83, 134, 139, 255),
|
||||
"chartreuse": (127, 255, 0, 255),
|
||||
"chartreuse1": (127, 255, 0, 255),
|
||||
"chartreuse2": (118, 238, 0, 255),
|
||||
"chartreuse3": (102, 205, 0, 255),
|
||||
"chartreuse4": (69, 139, 0, 255),
|
||||
"chocolate": (210, 105, 30, 255),
|
||||
"chocolate1": (255, 127, 36, 255),
|
||||
"chocolate2": (238, 118, 33, 255),
|
||||
"chocolate3": (205, 102, 29, 255),
|
||||
"chocolate4": (139, 69, 19, 255),
|
||||
"coral": (255, 127, 80, 255),
|
||||
"coral1": (255, 114, 86, 255),
|
||||
"coral2": (238, 106, 80, 255),
|
||||
"coral3": (205, 91, 69, 255),
|
||||
"coral4": (139, 62, 47, 255),
|
||||
"cornflowerblue": (100, 149, 237, 255),
|
||||
"cornsilk": (255, 248, 220, 255),
|
||||
"cornsilk1": (255, 248, 220, 255),
|
||||
"cornsilk2": (238, 232, 205, 255),
|
||||
"cornsilk3": (205, 200, 177, 255),
|
||||
"cornsilk4": (139, 136, 120, 255),
|
||||
"crimson": (220, 20, 60, 255),
|
||||
"cyan": (0, 255, 255, 255),
|
||||
"cyan1": (0, 255, 255, 255),
|
||||
"cyan2": (0, 238, 238, 255),
|
||||
"cyan3": (0, 205, 205, 255),
|
||||
"cyan4": (0, 139, 139, 255),
|
||||
"darkblue": (0, 0, 139, 255),
|
||||
"darkcyan": (0, 139, 139, 255),
|
||||
"darkgoldenrod": (184, 134, 11, 255),
|
||||
"darkgoldenrod1": (255, 185, 15, 255),
|
||||
"darkgoldenrod2": (238, 173, 14, 255),
|
||||
"darkgoldenrod3": (205, 149, 12, 255),
|
||||
"darkgoldenrod4": (139, 101, 8, 255),
|
||||
"darkgray": (169, 169, 169, 255),
|
||||
"darkgreen": (0, 100, 0, 255),
|
||||
"darkgrey": (169, 169, 169, 255),
|
||||
"darkkhaki": (189, 183, 107, 255),
|
||||
"darkmagenta": (139, 0, 139, 255),
|
||||
"darkolivegreen": (85, 107, 47, 255),
|
||||
"darkolivegreen1": (202, 255, 112, 255),
|
||||
"darkolivegreen2": (188, 238, 104, 255),
|
||||
"darkolivegreen3": (162, 205, 90, 255),
|
||||
"darkolivegreen4": (110, 139, 61, 255),
|
||||
"darkorange": (255, 140, 0, 255),
|
||||
"darkorange1": (255, 127, 0, 255),
|
||||
"darkorange2": (238, 118, 0, 255),
|
||||
"darkorange3": (205, 102, 0, 255),
|
||||
"darkorange4": (139, 69, 0, 255),
|
||||
"darkorchid": (153, 50, 204, 255),
|
||||
"darkorchid1": (191, 62, 255, 255),
|
||||
"darkorchid2": (178, 58, 238, 255),
|
||||
"darkorchid3": (154, 50, 205, 255),
|
||||
"darkorchid4": (104, 34, 139, 255),
|
||||
"darkred": (139, 0, 0, 255),
|
||||
"darksalmon": (233, 150, 122, 255),
|
||||
"darkseagreen": (143, 188, 143, 255),
|
||||
"darkseagreen1": (193, 255, 193, 255),
|
||||
"darkseagreen2": (180, 238, 180, 255),
|
||||
"darkseagreen3": (155, 205, 155, 255),
|
||||
"darkseagreen4": (105, 139, 105, 255),
|
||||
"darkslateblue": (72, 61, 139, 255),
|
||||
"darkslategray": (47, 79, 79, 255),
|
||||
"darkslategray1": (151, 255, 255, 255),
|
||||
"darkslategray2": (141, 238, 238, 255),
|
||||
"darkslategray3": (121, 205, 205, 255),
|
||||
"darkslategray4": (82, 139, 139, 255),
|
||||
"darkslategrey": (47, 79, 79, 255),
|
||||
"darkturquoise": (0, 206, 209, 255),
|
||||
"darkviolet": (148, 0, 211, 255),
|
||||
"deeppink": (255, 20, 147, 255),
|
||||
"deeppink1": (255, 20, 147, 255),
|
||||
"deeppink2": (238, 18, 137, 255),
|
||||
"deeppink3": (205, 16, 118, 255),
|
||||
"deeppink4": (139, 10, 80, 255),
|
||||
"deepskyblue": (0, 191, 255, 255),
|
||||
"deepskyblue1": (0, 191, 255, 255),
|
||||
"deepskyblue2": (0, 178, 238, 255),
|
||||
"deepskyblue3": (0, 154, 205, 255),
|
||||
"deepskyblue4": (0, 104, 139, 255),
|
||||
"dimgray": (105, 105, 105, 255),
|
||||
"dimgrey": (105, 105, 105, 255),
|
||||
"dodgerblue": (30, 144, 255, 255),
|
||||
"dodgerblue1": (30, 144, 255, 255),
|
||||
"dodgerblue2": (28, 134, 238, 255),
|
||||
"dodgerblue3": (24, 116, 205, 255),
|
||||
"dodgerblue4": (16, 78, 139, 255),
|
||||
"firebrick": (178, 34, 34, 255),
|
||||
"firebrick1": (255, 48, 48, 255),
|
||||
"firebrick2": (238, 44, 44, 255),
|
||||
"firebrick3": (205, 38, 38, 255),
|
||||
"firebrick4": (139, 26, 26, 255),
|
||||
"floralwhite": (255, 250, 240, 255),
|
||||
"forestgreen": (34, 139, 34, 255),
|
||||
"fuchsia": (255, 0, 255, 255),
|
||||
"gainsboro": (220, 220, 220, 255),
|
||||
"ghostwhite": (248, 248, 255, 255),
|
||||
"gold": (255, 215, 0, 255),
|
||||
"gold1": (255, 215, 0, 255),
|
||||
"gold2": (238, 201, 0, 255),
|
||||
"gold3": (205, 173, 0, 255),
|
||||
"gold4": (139, 117, 0, 255),
|
||||
"goldenrod": (218, 165, 32, 255),
|
||||
"goldenrod1": (255, 193, 37, 255),
|
||||
"goldenrod2": (238, 180, 34, 255),
|
||||
"goldenrod3": (205, 155, 29, 255),
|
||||
"goldenrod4": (139, 105, 20, 255),
|
||||
"gray": (190, 190, 190, 255),
|
||||
"gray0": (0, 0, 0, 255),
|
||||
"gray1": (3, 3, 3, 255),
|
||||
"gray2": (5, 5, 5, 255),
|
||||
"gray3": (8, 8, 8, 255),
|
||||
"gray4": (10, 10, 10, 255),
|
||||
"gray5": (13, 13, 13, 255),
|
||||
"gray6": (15, 15, 15, 255),
|
||||
"gray7": (18, 18, 18, 255),
|
||||
"gray8": (20, 20, 20, 255),
|
||||
"gray9": (23, 23, 23, 255),
|
||||
"gray10": (26, 26, 26, 255),
|
||||
"gray11": (28, 28, 28, 255),
|
||||
"gray12": (31, 31, 31, 255),
|
||||
"gray13": (33, 33, 33, 255),
|
||||
"gray14": (36, 36, 36, 255),
|
||||
"gray15": (38, 38, 38, 255),
|
||||
"gray16": (41, 41, 41, 255),
|
||||
"gray17": (43, 43, 43, 255),
|
||||
"gray18": (46, 46, 46, 255),
|
||||
"gray19": (48, 48, 48, 255),
|
||||
"gray20": (51, 51, 51, 255),
|
||||
"gray21": (54, 54, 54, 255),
|
||||
"gray22": (56, 56, 56, 255),
|
||||
"gray23": (59, 59, 59, 255),
|
||||
"gray24": (61, 61, 61, 255),
|
||||
"gray25": (64, 64, 64, 255),
|
||||
"gray26": (66, 66, 66, 255),
|
||||
"gray27": (69, 69, 69, 255),
|
||||
"gray28": (71, 71, 71, 255),
|
||||
"gray29": (74, 74, 74, 255),
|
||||
"gray30": (77, 77, 77, 255),
|
||||
"gray31": (79, 79, 79, 255),
|
||||
"gray32": (82, 82, 82, 255),
|
||||
"gray33": (84, 84, 84, 255),
|
||||
"gray34": (87, 87, 87, 255),
|
||||
"gray35": (89, 89, 89, 255),
|
||||
"gray36": (92, 92, 92, 255),
|
||||
"gray37": (94, 94, 94, 255),
|
||||
"gray38": (97, 97, 97, 255),
|
||||
"gray39": (99, 99, 99, 255),
|
||||
"gray40": (102, 102, 102, 255),
|
||||
"gray41": (105, 105, 105, 255),
|
||||
"gray42": (107, 107, 107, 255),
|
||||
"gray43": (110, 110, 110, 255),
|
||||
"gray44": (112, 112, 112, 255),
|
||||
"gray45": (115, 115, 115, 255),
|
||||
"gray46": (117, 117, 117, 255),
|
||||
"gray47": (120, 120, 120, 255),
|
||||
"gray48": (122, 122, 122, 255),
|
||||
"gray49": (125, 125, 125, 255),
|
||||
"gray50": (127, 127, 127, 255),
|
||||
"gray51": (130, 130, 130, 255),
|
||||
"gray52": (133, 133, 133, 255),
|
||||
"gray53": (135, 135, 135, 255),
|
||||
"gray54": (138, 138, 138, 255),
|
||||
"gray55": (140, 140, 140, 255),
|
||||
"gray56": (143, 143, 143, 255),
|
||||
"gray57": (145, 145, 145, 255),
|
||||
"gray58": (148, 148, 148, 255),
|
||||
"gray59": (150, 150, 150, 255),
|
||||
"gray60": (153, 153, 153, 255),
|
||||
"gray61": (156, 156, 156, 255),
|
||||
"gray62": (158, 158, 158, 255),
|
||||
"gray63": (161, 161, 161, 255),
|
||||
"gray64": (163, 163, 163, 255),
|
||||
"gray65": (166, 166, 166, 255),
|
||||
"gray66": (168, 168, 168, 255),
|
||||
"gray67": (171, 171, 171, 255),
|
||||
"gray68": (173, 173, 173, 255),
|
||||
"gray69": (176, 176, 176, 255),
|
||||
"gray70": (179, 179, 179, 255),
|
||||
"gray71": (181, 181, 181, 255),
|
||||
"gray72": (184, 184, 184, 255),
|
||||
"gray73": (186, 186, 186, 255),
|
||||
"gray74": (189, 189, 189, 255),
|
||||
"gray75": (191, 191, 191, 255),
|
||||
"gray76": (194, 194, 194, 255),
|
||||
"gray77": (196, 196, 196, 255),
|
||||
"gray78": (199, 199, 199, 255),
|
||||
"gray79": (201, 201, 201, 255),
|
||||
"gray80": (204, 204, 204, 255),
|
||||
"gray81": (207, 207, 207, 255),
|
||||
"gray82": (209, 209, 209, 255),
|
||||
"gray83": (212, 212, 212, 255),
|
||||
"gray84": (214, 214, 214, 255),
|
||||
"gray85": (217, 217, 217, 255),
|
||||
"gray86": (219, 219, 219, 255),
|
||||
"gray87": (222, 222, 222, 255),
|
||||
"gray88": (224, 224, 224, 255),
|
||||
"gray89": (227, 227, 227, 255),
|
||||
"gray90": (229, 229, 229, 255),
|
||||
"gray91": (232, 232, 232, 255),
|
||||
"gray92": (235, 235, 235, 255),
|
||||
"gray93": (237, 237, 237, 255),
|
||||
"gray94": (240, 240, 240, 255),
|
||||
"gray95": (242, 242, 242, 255),
|
||||
"gray96": (245, 245, 245, 255),
|
||||
"gray97": (247, 247, 247, 255),
|
||||
"gray98": (250, 250, 250, 255),
|
||||
"gray99": (252, 252, 252, 255),
|
||||
"gray100": (255, 255, 255, 255),
|
||||
"green": (0, 255, 0, 255),
|
||||
"green1": (0, 255, 0, 255),
|
||||
"green2": (0, 238, 0, 255),
|
||||
"green3": (0, 205, 0, 255),
|
||||
"green4": (0, 139, 0, 255),
|
||||
"greenyellow": (173, 255, 47, 255),
|
||||
"grey": (190, 190, 190, 255),
|
||||
"grey0": (0, 0, 0, 255),
|
||||
"grey1": (3, 3, 3, 255),
|
||||
"grey2": (5, 5, 5, 255),
|
||||
"grey3": (8, 8, 8, 255),
|
||||
"grey4": (10, 10, 10, 255),
|
||||
"grey5": (13, 13, 13, 255),
|
||||
"grey6": (15, 15, 15, 255),
|
||||
"grey7": (18, 18, 18, 255),
|
||||
"grey8": (20, 20, 20, 255),
|
||||
"grey9": (23, 23, 23, 255),
|
||||
"grey10": (26, 26, 26, 255),
|
||||
"grey11": (28, 28, 28, 255),
|
||||
"grey12": (31, 31, 31, 255),
|
||||
"grey13": (33, 33, 33, 255),
|
||||
"grey14": (36, 36, 36, 255),
|
||||
"grey15": (38, 38, 38, 255),
|
||||
"grey16": (41, 41, 41, 255),
|
||||
"grey17": (43, 43, 43, 255),
|
||||
"grey18": (46, 46, 46, 255),
|
||||
"grey19": (48, 48, 48, 255),
|
||||
"grey20": (51, 51, 51, 255),
|
||||
"grey21": (54, 54, 54, 255),
|
||||
"grey22": (56, 56, 56, 255),
|
||||
"grey23": (59, 59, 59, 255),
|
||||
"grey24": (61, 61, 61, 255),
|
||||
"grey25": (64, 64, 64, 255),
|
||||
"grey26": (66, 66, 66, 255),
|
||||
"grey27": (69, 69, 69, 255),
|
||||
"grey28": (71, 71, 71, 255),
|
||||
"grey29": (74, 74, 74, 255),
|
||||
"grey30": (77, 77, 77, 255),
|
||||
"grey31": (79, 79, 79, 255),
|
||||
"grey32": (82, 82, 82, 255),
|
||||
"grey33": (84, 84, 84, 255),
|
||||
"grey34": (87, 87, 87, 255),
|
||||
"grey35": (89, 89, 89, 255),
|
||||
"grey36": (92, 92, 92, 255),
|
||||
"grey37": (94, 94, 94, 255),
|
||||
"grey38": (97, 97, 97, 255),
|
||||
"grey39": (99, 99, 99, 255),
|
||||
"grey40": (102, 102, 102, 255),
|
||||
"grey41": (105, 105, 105, 255),
|
||||
"grey42": (107, 107, 107, 255),
|
||||
"grey43": (110, 110, 110, 255),
|
||||
"grey44": (112, 112, 112, 255),
|
||||
"grey45": (115, 115, 115, 255),
|
||||
"grey46": (117, 117, 117, 255),
|
||||
"grey47": (120, 120, 120, 255),
|
||||
"grey48": (122, 122, 122, 255),
|
||||
"grey49": (125, 125, 125, 255),
|
||||
"grey50": (127, 127, 127, 255),
|
||||
"grey51": (130, 130, 130, 255),
|
||||
"grey52": (133, 133, 133, 255),
|
||||
"grey53": (135, 135, 135, 255),
|
||||
"grey54": (138, 138, 138, 255),
|
||||
"grey55": (140, 140, 140, 255),
|
||||
"grey56": (143, 143, 143, 255),
|
||||
"grey57": (145, 145, 145, 255),
|
||||
"grey58": (148, 148, 148, 255),
|
||||
"grey59": (150, 150, 150, 255),
|
||||
"grey60": (153, 153, 153, 255),
|
||||
"grey61": (156, 156, 156, 255),
|
||||
"grey62": (158, 158, 158, 255),
|
||||
"grey63": (161, 161, 161, 255),
|
||||
"grey64": (163, 163, 163, 255),
|
||||
"grey65": (166, 166, 166, 255),
|
||||
"grey66": (168, 168, 168, 255),
|
||||
"grey67": (171, 171, 171, 255),
|
||||
"grey68": (173, 173, 173, 255),
|
||||
"grey69": (176, 176, 176, 255),
|
||||
"grey70": (179, 179, 179, 255),
|
||||
"grey71": (181, 181, 181, 255),
|
||||
"grey72": (184, 184, 184, 255),
|
||||
"grey73": (186, 186, 186, 255),
|
||||
"grey74": (189, 189, 189, 255),
|
||||
"grey75": (191, 191, 191, 255),
|
||||
"grey76": (194, 194, 194, 255),
|
||||
"grey77": (196, 196, 196, 255),
|
||||
"grey78": (199, 199, 199, 255),
|
||||
"grey79": (201, 201, 201, 255),
|
||||
"grey80": (204, 204, 204, 255),
|
||||
"grey81": (207, 207, 207, 255),
|
||||
"grey82": (209, 209, 209, 255),
|
||||
"grey83": (212, 212, 212, 255),
|
||||
"grey84": (214, 214, 214, 255),
|
||||
"grey85": (217, 217, 217, 255),
|
||||
"grey86": (219, 219, 219, 255),
|
||||
"grey87": (222, 222, 222, 255),
|
||||
"grey88": (224, 224, 224, 255),
|
||||
"grey89": (227, 227, 227, 255),
|
||||
"grey90": (229, 229, 229, 255),
|
||||
"grey91": (232, 232, 232, 255),
|
||||
"grey92": (235, 235, 235, 255),
|
||||
"grey93": (237, 237, 237, 255),
|
||||
"grey94": (240, 240, 240, 255),
|
||||
"grey95": (242, 242, 242, 255),
|
||||
"grey96": (245, 245, 245, 255),
|
||||
"grey97": (247, 247, 247, 255),
|
||||
"grey98": (250, 250, 250, 255),
|
||||
"grey99": (252, 252, 252, 255),
|
||||
"grey100": (255, 255, 255, 255),
|
||||
"honeydew": (240, 255, 240, 255),
|
||||
"honeydew1": (240, 255, 240, 255),
|
||||
"honeydew2": (224, 238, 224, 255),
|
||||
"honeydew3": (193, 205, 193, 255),
|
||||
"honeydew4": (131, 139, 131, 255),
|
||||
"hotpink": (255, 105, 180, 255),
|
||||
"hotpink1": (255, 110, 180, 255),
|
||||
"hotpink2": (238, 106, 167, 255),
|
||||
"hotpink3": (205, 96, 144, 255),
|
||||
"hotpink4": (139, 58, 98, 255),
|
||||
"indianred": (205, 92, 92, 255),
|
||||
"indianred1": (255, 106, 106, 255),
|
||||
"indianred2": (238, 99, 99, 255),
|
||||
"indianred3": (205, 85, 85, 255),
|
||||
"indianred4": (139, 58, 58, 255),
|
||||
"indigo": (75, 0, 130, 255),
|
||||
"ivory": (255, 255, 240, 255),
|
||||
"ivory1": (255, 255, 240, 255),
|
||||
"ivory2": (238, 238, 224, 255),
|
||||
"ivory3": (205, 205, 193, 255),
|
||||
"ivory4": (139, 139, 131, 255),
|
||||
"khaki": (240, 230, 140, 255),
|
||||
"khaki1": (255, 246, 143, 255),
|
||||
"khaki2": (238, 230, 133, 255),
|
||||
"khaki3": (205, 198, 115, 255),
|
||||
"khaki4": (139, 134, 78, 255),
|
||||
"lavender": (230, 230, 250, 255),
|
||||
"lavenderblush": (255, 240, 245, 255),
|
||||
"lavenderblush1": (255, 240, 245, 255),
|
||||
"lavenderblush2": (238, 224, 229, 255),
|
||||
"lavenderblush3": (205, 193, 197, 255),
|
||||
"lavenderblush4": (139, 131, 134, 255),
|
||||
"lawngreen": (124, 252, 0, 255),
|
||||
"lemonchiffon": (255, 250, 205, 255),
|
||||
"lemonchiffon1": (255, 250, 205, 255),
|
||||
"lemonchiffon2": (238, 233, 191, 255),
|
||||
"lemonchiffon3": (205, 201, 165, 255),
|
||||
"lemonchiffon4": (139, 137, 112, 255),
|
||||
"lightblue": (173, 216, 230, 255),
|
||||
"lightblue1": (191, 239, 255, 255),
|
||||
"lightblue2": (178, 223, 238, 255),
|
||||
"lightblue3": (154, 192, 205, 255),
|
||||
"lightblue4": (104, 131, 139, 255),
|
||||
"lightcoral": (240, 128, 128, 255),
|
||||
"lightcyan": (224, 255, 255, 255),
|
||||
"lightcyan1": (224, 255, 255, 255),
|
||||
"lightcyan2": (209, 238, 238, 255),
|
||||
"lightcyan3": (180, 205, 205, 255),
|
||||
"lightcyan4": (122, 139, 139, 255),
|
||||
"lightgoldenrod": (238, 221, 130, 255),
|
||||
"lightgoldenrod1": (255, 236, 139, 255),
|
||||
"lightgoldenrod2": (238, 220, 130, 255),
|
||||
"lightgoldenrod3": (205, 190, 112, 255),
|
||||
"lightgoldenrod4": (139, 129, 76, 255),
|
||||
"lightgoldenrodyellow": (250, 250, 210, 255),
|
||||
"lightgray": (211, 211, 211, 255),
|
||||
"lightgreen": (144, 238, 144, 255),
|
||||
"lightgrey": (211, 211, 211, 255),
|
||||
"lightpink": (255, 182, 193, 255),
|
||||
"lightpink1": (255, 174, 185, 255),
|
||||
"lightpink2": (238, 162, 173, 255),
|
||||
"lightpink3": (205, 140, 149, 255),
|
||||
"lightpink4": (139, 95, 101, 255),
|
||||
"lightsalmon": (255, 160, 122, 255),
|
||||
"lightsalmon1": (255, 160, 122, 255),
|
||||
"lightsalmon2": (238, 149, 114, 255),
|
||||
"lightsalmon3": (205, 129, 98, 255),
|
||||
"lightsalmon4": (139, 87, 66, 255),
|
||||
"lightseagreen": (32, 178, 170, 255),
|
||||
"lightskyblue": (135, 206, 250, 255),
|
||||
"lightskyblue1": (176, 226, 255, 255),
|
||||
"lightskyblue2": (164, 211, 238, 255),
|
||||
"lightskyblue3": (141, 182, 205, 255),
|
||||
"lightskyblue4": (96, 123, 139, 255),
|
||||
"lightslateblue": (132, 112, 255, 255),
|
||||
"lightslategray": (119, 136, 153, 255),
|
||||
"lightslategrey": (119, 136, 153, 255),
|
||||
"lightsteelblue": (176, 196, 222, 255),
|
||||
"lightsteelblue1": (202, 225, 255, 255),
|
||||
"lightsteelblue2": (188, 210, 238, 255),
|
||||
"lightsteelblue3": (162, 181, 205, 255),
|
||||
"lightsteelblue4": (110, 123, 139, 255),
|
||||
"lightyellow": (255, 255, 224, 255),
|
||||
"lightyellow1": (255, 255, 224, 255),
|
||||
"lightyellow2": (238, 238, 209, 255),
|
||||
"lightyellow3": (205, 205, 180, 255),
|
||||
"lightyellow4": (139, 139, 122, 255),
|
||||
"linen": (250, 240, 230, 255),
|
||||
"lime": (0, 255, 0, 255),
|
||||
"limegreen": (50, 205, 50, 255),
|
||||
"magenta": (255, 0, 255, 255),
|
||||
"magenta1": (255, 0, 255, 255),
|
||||
"magenta2": (238, 0, 238, 255),
|
||||
"magenta3": (205, 0, 205, 255),
|
||||
"magenta4": (139, 0, 139, 255),
|
||||
"maroon": (176, 48, 96, 255),
|
||||
"maroon1": (255, 52, 179, 255),
|
||||
"maroon2": (238, 48, 167, 255),
|
||||
"maroon3": (205, 41, 144, 255),
|
||||
"maroon4": (139, 28, 98, 255),
|
||||
"mediumaquamarine": (102, 205, 170, 255),
|
||||
"mediumblue": (0, 0, 205, 255),
|
||||
"mediumorchid": (186, 85, 211, 255),
|
||||
"mediumorchid1": (224, 102, 255, 255),
|
||||
"mediumorchid2": (209, 95, 238, 255),
|
||||
"mediumorchid3": (180, 82, 205, 255),
|
||||
"mediumorchid4": (122, 55, 139, 255),
|
||||
"mediumpurple": (147, 112, 219, 255),
|
||||
"mediumpurple1": (171, 130, 255, 255),
|
||||
"mediumpurple2": (159, 121, 238, 255),
|
||||
"mediumpurple3": (137, 104, 205, 255),
|
||||
"mediumpurple4": (93, 71, 139, 255),
|
||||
"mediumseagreen": (60, 179, 113, 255),
|
||||
"mediumslateblue": (123, 104, 238, 255),
|
||||
"mediumspringgreen": (0, 250, 154, 255),
|
||||
"mediumturquoise": (72, 209, 204, 255),
|
||||
"mediumvioletred": (199, 21, 133, 255),
|
||||
"midnightblue": (25, 25, 112, 255),
|
||||
"mintcream": (245, 255, 250, 255),
|
||||
"mistyrose": (255, 228, 225, 255),
|
||||
"mistyrose1": (255, 228, 225, 255),
|
||||
"mistyrose2": (238, 213, 210, 255),
|
||||
"mistyrose3": (205, 183, 181, 255),
|
||||
"mistyrose4": (139, 125, 123, 255),
|
||||
"moccasin": (255, 228, 181, 255),
|
||||
"navajowhite": (255, 222, 173, 255),
|
||||
"navajowhite1": (255, 222, 173, 255),
|
||||
"navajowhite2": (238, 207, 161, 255),
|
||||
"navajowhite3": (205, 179, 139, 255),
|
||||
"navajowhite4": (139, 121, 94, 255),
|
||||
"navy": (0, 0, 128, 255),
|
||||
"navyblue": (0, 0, 128, 255),
|
||||
"oldlace": (253, 245, 230, 255),
|
||||
"olive": (128, 128, 0, 255),
|
||||
"olivedrab": (107, 142, 35, 255),
|
||||
"olivedrab1": (192, 255, 62, 255),
|
||||
"olivedrab2": (179, 238, 58, 255),
|
||||
"olivedrab3": (154, 205, 50, 255),
|
||||
"olivedrab4": (105, 139, 34, 255),
|
||||
"orange": (255, 165, 0, 255),
|
||||
"orange1": (255, 165, 0, 255),
|
||||
"orange2": (238, 154, 0, 255),
|
||||
"orange3": (205, 133, 0, 255),
|
||||
"orange4": (139, 90, 0, 255),
|
||||
"orangered": (255, 69, 0, 255),
|
||||
"orangered1": (255, 69, 0, 255),
|
||||
"orangered2": (238, 64, 0, 255),
|
||||
"orangered3": (205, 55, 0, 255),
|
||||
"orangered4": (139, 37, 0, 255),
|
||||
"orchid": (218, 112, 214, 255),
|
||||
"orchid1": (255, 131, 250, 255),
|
||||
"orchid2": (238, 122, 233, 255),
|
||||
"orchid3": (205, 105, 201, 255),
|
||||
"orchid4": (139, 71, 137, 255),
|
||||
"palegreen": (152, 251, 152, 255),
|
||||
"palegreen1": (154, 255, 154, 255),
|
||||
"palegreen2": (144, 238, 144, 255),
|
||||
"palegreen3": (124, 205, 124, 255),
|
||||
"palegreen4": (84, 139, 84, 255),
|
||||
"palegoldenrod": (238, 232, 170, 255),
|
||||
"paleturquoise": (175, 238, 238, 255),
|
||||
"paleturquoise1": (187, 255, 255, 255),
|
||||
"paleturquoise2": (174, 238, 238, 255),
|
||||
"paleturquoise3": (150, 205, 205, 255),
|
||||
"paleturquoise4": (102, 139, 139, 255),
|
||||
"palevioletred": (219, 112, 147, 255),
|
||||
"palevioletred1": (255, 130, 171, 255),
|
||||
"palevioletred2": (238, 121, 159, 255),
|
||||
"palevioletred3": (205, 104, 137, 255),
|
||||
"palevioletred4": (139, 71, 93, 255),
|
||||
"papayawhip": (255, 239, 213, 255),
|
||||
"peachpuff": (255, 218, 185, 255),
|
||||
"peachpuff1": (255, 218, 185, 255),
|
||||
"peachpuff2": (238, 203, 173, 255),
|
||||
"peachpuff3": (205, 175, 149, 255),
|
||||
"peachpuff4": (139, 119, 101, 255),
|
||||
"peru": (205, 133, 63, 255),
|
||||
"pink": (255, 192, 203, 255),
|
||||
"pink1": (255, 181, 197, 255),
|
||||
"pink2": (238, 169, 184, 255),
|
||||
"pink3": (205, 145, 158, 255),
|
||||
"pink4": (139, 99, 108, 255),
|
||||
"plum": (221, 160, 221, 255),
|
||||
"plum1": (255, 187, 255, 255),
|
||||
"plum2": (238, 174, 238, 255),
|
||||
"plum3": (205, 150, 205, 255),
|
||||
"plum4": (139, 102, 139, 255),
|
||||
"powderblue": (176, 224, 230, 255),
|
||||
"purple": (160, 32, 240, 255),
|
||||
"purple1": (155, 48, 255, 255),
|
||||
"purple2": (145, 44, 238, 255),
|
||||
"purple3": (125, 38, 205, 255),
|
||||
"purple4": (85, 26, 139, 255),
|
||||
"red": (255, 0, 0, 255),
|
||||
"red1": (255, 0, 0, 255),
|
||||
"red2": (238, 0, 0, 255),
|
||||
"red3": (205, 0, 0, 255),
|
||||
"red4": (139, 0, 0, 255),
|
||||
"rosybrown": (188, 143, 143, 255),
|
||||
"rosybrown1": (255, 193, 193, 255),
|
||||
"rosybrown2": (238, 180, 180, 255),
|
||||
"rosybrown3": (205, 155, 155, 255),
|
||||
"rosybrown4": (139, 105, 105, 255),
|
||||
"royalblue": (65, 105, 225, 255),
|
||||
"royalblue1": (72, 118, 255, 255),
|
||||
"royalblue2": (67, 110, 238, 255),
|
||||
"royalblue3": (58, 95, 205, 255),
|
||||
"royalblue4": (39, 64, 139, 255),
|
||||
"salmon": (250, 128, 114, 255),
|
||||
"salmon1": (255, 140, 105, 255),
|
||||
"salmon2": (238, 130, 98, 255),
|
||||
"salmon3": (205, 112, 84, 255),
|
||||
"salmon4": (139, 76, 57, 255),
|
||||
"saddlebrown": (139, 69, 19, 255),
|
||||
"sandybrown": (244, 164, 96, 255),
|
||||
"seagreen": (46, 139, 87, 255),
|
||||
"seagreen1": (84, 255, 159, 255),
|
||||
"seagreen2": (78, 238, 148, 255),
|
||||
"seagreen3": (67, 205, 128, 255),
|
||||
"seagreen4": (46, 139, 87, 255),
|
||||
"seashell": (255, 245, 238, 255),
|
||||
"seashell1": (255, 245, 238, 255),
|
||||
"seashell2": (238, 229, 222, 255),
|
||||
"seashell3": (205, 197, 191, 255),
|
||||
"seashell4": (139, 134, 130, 255),
|
||||
"sienna": (160, 82, 45, 255),
|
||||
"sienna1": (255, 130, 71, 255),
|
||||
"sienna2": (238, 121, 66, 255),
|
||||
"sienna3": (205, 104, 57, 255),
|
||||
"sienna4": (139, 71, 38, 255),
|
||||
"silver": (192, 192, 192, 255),
|
||||
"skyblue": (135, 206, 235, 255),
|
||||
"skyblue1": (135, 206, 255, 255),
|
||||
"skyblue2": (126, 192, 238, 255),
|
||||
"skyblue3": (108, 166, 205, 255),
|
||||
"skyblue4": (74, 112, 139, 255),
|
||||
"slateblue": (106, 90, 205, 255),
|
||||
"slateblue1": (131, 111, 255, 255),
|
||||
"slateblue2": (122, 103, 238, 255),
|
||||
"slateblue3": (105, 89, 205, 255),
|
||||
"slateblue4": (71, 60, 139, 255),
|
||||
"slategray": (112, 128, 144, 255),
|
||||
"slategray1": (198, 226, 255, 255),
|
||||
"slategray2": (185, 211, 238, 255),
|
||||
"slategray3": (159, 182, 205, 255),
|
||||
"slategray4": (108, 123, 139, 255),
|
||||
"slategrey": (112, 128, 144, 255),
|
||||
"snow": (255, 250, 250, 255),
|
||||
"snow1": (255, 250, 250, 255),
|
||||
"snow2": (238, 233, 233, 255),
|
||||
"snow3": (205, 201, 201, 255),
|
||||
"snow4": (139, 137, 137, 255),
|
||||
"springgreen": (0, 255, 127, 255),
|
||||
"springgreen1": (0, 255, 127, 255),
|
||||
"springgreen2": (0, 238, 118, 255),
|
||||
"springgreen3": (0, 205, 102, 255),
|
||||
"springgreen4": (0, 139, 69, 255),
|
||||
"steelblue": (70, 130, 180, 255),
|
||||
"steelblue1": (99, 184, 255, 255),
|
||||
"steelblue2": (92, 172, 238, 255),
|
||||
"steelblue3": (79, 148, 205, 255),
|
||||
"steelblue4": (54, 100, 139, 255),
|
||||
"tan": (210, 180, 140, 255),
|
||||
"tan1": (255, 165, 79, 255),
|
||||
"tan2": (238, 154, 73, 255),
|
||||
"tan3": (205, 133, 63, 255),
|
||||
"tan4": (139, 90, 43, 255),
|
||||
"teal": (0, 128, 128, 255),
|
||||
"thistle": (216, 191, 216, 255),
|
||||
"thistle1": (255, 225, 255, 255),
|
||||
"thistle2": (238, 210, 238, 255),
|
||||
"thistle3": (205, 181, 205, 255),
|
||||
"thistle4": (139, 123, 139, 255),
|
||||
"tomato": (255, 99, 71, 255),
|
||||
"tomato1": (255, 99, 71, 255),
|
||||
"tomato2": (238, 92, 66, 255),
|
||||
"tomato3": (205, 79, 57, 255),
|
||||
"tomato4": (139, 54, 38, 255),
|
||||
"turquoise": (64, 224, 208, 255),
|
||||
"turquoise1": (0, 245, 255, 255),
|
||||
"turquoise2": (0, 229, 238, 255),
|
||||
"turquoise3": (0, 197, 205, 255),
|
||||
"turquoise4": (0, 134, 139, 255),
|
||||
"violet": (238, 130, 238, 255),
|
||||
"violetred": (208, 32, 144, 255),
|
||||
"violetred1": (255, 62, 150, 255),
|
||||
"violetred2": (238, 58, 140, 255),
|
||||
"violetred3": (205, 50, 120, 255),
|
||||
"violetred4": (139, 34, 82, 255),
|
||||
"wheat": (245, 222, 179, 255),
|
||||
"wheat1": (255, 231, 186, 255),
|
||||
"wheat2": (238, 216, 174, 255),
|
||||
"wheat3": (205, 186, 150, 255),
|
||||
"wheat4": (139, 126, 102, 255),
|
||||
"white": (255, 255, 255, 255),
|
||||
"whitesmoke": (245, 245, 245, 255),
|
||||
"yellow": (255, 255, 0, 255),
|
||||
"yellow1": (255, 255, 0, 255),
|
||||
"yellow2": (238, 238, 0, 255),
|
||||
"yellow3": (205, 205, 0, 255),
|
||||
"yellow4": (139, 139, 0, 255),
|
||||
"yellowgreen": (154, 205, 50, 255),
|
||||
}
|
||||
557
.venv/lib/python3.8/site-packages/pygame/constants.pyi
Normal file
|
|
@ -0,0 +1,557 @@
|
|||
"""
|
||||
Script used to generate this file (if we change something in the constants in the future):
|
||||
import pygame.constants
|
||||
const = []
|
||||
for element in dir(pygame.constants):
|
||||
constant_type = getattr(pygame.constants, element)
|
||||
if not element.startswith("_"):
|
||||
const.append("{}: {}\n".format(element, constant_type.__class__.__name__))
|
||||
with open("constants.pyi", "w") as f:
|
||||
f.write("from typing import List\n\n\n")
|
||||
for line in const:
|
||||
f.write(str(line))
|
||||
f.write("__all__: List[str]\n")
|
||||
"""
|
||||
|
||||
from typing import List
|
||||
|
||||
ACTIVEEVENT: int
|
||||
ANYFORMAT: int
|
||||
APPACTIVE: int
|
||||
APPFOCUSMOUSE: int
|
||||
APPINPUTFOCUS: int
|
||||
ASYNCBLIT: int
|
||||
AUDIODEVICEADDED: int
|
||||
AUDIODEVICEREMOVED: int
|
||||
AUDIO_ALLOW_ANY_CHANGE: int
|
||||
AUDIO_ALLOW_CHANNELS_CHANGE: int
|
||||
AUDIO_ALLOW_FORMAT_CHANGE: int
|
||||
AUDIO_ALLOW_FREQUENCY_CHANGE: int
|
||||
AUDIO_S16: int
|
||||
AUDIO_S16LSB: int
|
||||
AUDIO_S16MSB: int
|
||||
AUDIO_S16SYS: int
|
||||
AUDIO_S8: int
|
||||
AUDIO_U16: int
|
||||
AUDIO_U16LSB: int
|
||||
AUDIO_U16MSB: int
|
||||
AUDIO_U16SYS: int
|
||||
AUDIO_U8: int
|
||||
BIG_ENDIAN: int
|
||||
BLENDMODE_ADD: int
|
||||
BLENDMODE_BLEND: int
|
||||
BLENDMODE_MOD: int
|
||||
BLENDMODE_NONE: int
|
||||
BLEND_ADD: int
|
||||
BLEND_ALPHA_SDL2: int
|
||||
BLEND_MAX: int
|
||||
BLEND_MIN: int
|
||||
BLEND_MULT: int
|
||||
BLEND_PREMULTIPLIED: int
|
||||
BLEND_RGBA_ADD: int
|
||||
BLEND_RGBA_MAX: int
|
||||
BLEND_RGBA_MIN: int
|
||||
BLEND_RGBA_MULT: int
|
||||
BLEND_RGBA_SUB: int
|
||||
BLEND_RGB_ADD: int
|
||||
BLEND_RGB_MAX: int
|
||||
BLEND_RGB_MIN: int
|
||||
BLEND_RGB_MULT: int
|
||||
BLEND_RGB_SUB: int
|
||||
BLEND_SUB: int
|
||||
BUTTON_LEFT: int
|
||||
BUTTON_MIDDLE: int
|
||||
BUTTON_RIGHT: int
|
||||
BUTTON_WHEELDOWN: int
|
||||
BUTTON_WHEELUP: int
|
||||
BUTTON_X1: int
|
||||
BUTTON_X2: int
|
||||
CONTROLLERAXISMOTION: int
|
||||
CONTROLLERBUTTONDOWN: int
|
||||
CONTROLLERBUTTONUP: int
|
||||
CONTROLLERDEVICEADDED: int
|
||||
CONTROLLERDEVICEREMAPPED: int
|
||||
CONTROLLERDEVICEREMOVED: int
|
||||
CONTROLLER_AXIS_INVALID: int
|
||||
CONTROLLER_AXIS_LEFTX: int
|
||||
CONTROLLER_AXIS_LEFTY: int
|
||||
CONTROLLER_AXIS_MAX: int
|
||||
CONTROLLER_AXIS_RIGHTX: int
|
||||
CONTROLLER_AXIS_RIGHTY: int
|
||||
CONTROLLER_AXIS_TRIGGERLEFT: int
|
||||
CONTROLLER_AXIS_TRIGGERRIGHT: int
|
||||
CONTROLLER_BUTTON_A: int
|
||||
CONTROLLER_BUTTON_B: int
|
||||
CONTROLLER_BUTTON_BACK: int
|
||||
CONTROLLER_BUTTON_DPAD_DOWN: int
|
||||
CONTROLLER_BUTTON_DPAD_LEFT: int
|
||||
CONTROLLER_BUTTON_DPAD_RIGHT: int
|
||||
CONTROLLER_BUTTON_DPAD_UP: int
|
||||
CONTROLLER_BUTTON_GUIDE: int
|
||||
CONTROLLER_BUTTON_INVALID: int
|
||||
CONTROLLER_BUTTON_LEFTSHOULDER: int
|
||||
CONTROLLER_BUTTON_LEFTSTICK: int
|
||||
CONTROLLER_BUTTON_MAX: int
|
||||
CONTROLLER_BUTTON_RIGHTSHOULDER: int
|
||||
CONTROLLER_BUTTON_RIGHTSTICK: int
|
||||
CONTROLLER_BUTTON_START: int
|
||||
CONTROLLER_BUTTON_X: int
|
||||
CONTROLLER_BUTTON_Y: int
|
||||
DOUBLEBUF: int
|
||||
DROPBEGIN: int
|
||||
DROPCOMPLETE: int
|
||||
DROPFILE: int
|
||||
DROPTEXT: int
|
||||
FINGERDOWN: int
|
||||
FINGERMOTION: int
|
||||
FINGERUP: int
|
||||
FULLSCREEN: int
|
||||
GL_ACCELERATED_VISUAL: int
|
||||
GL_ACCUM_ALPHA_SIZE: int
|
||||
GL_ACCUM_BLUE_SIZE: int
|
||||
GL_ACCUM_GREEN_SIZE: int
|
||||
GL_ACCUM_RED_SIZE: int
|
||||
GL_ALPHA_SIZE: int
|
||||
GL_BLUE_SIZE: int
|
||||
GL_BUFFER_SIZE: int
|
||||
GL_CONTEXT_DEBUG_FLAG: int
|
||||
GL_CONTEXT_FLAGS: int
|
||||
GL_CONTEXT_FORWARD_COMPATIBLE_FLAG: int
|
||||
GL_CONTEXT_MAJOR_VERSION: int
|
||||
GL_CONTEXT_MINOR_VERSION: int
|
||||
GL_CONTEXT_PROFILE_COMPATIBILITY: int
|
||||
GL_CONTEXT_PROFILE_CORE: int
|
||||
GL_CONTEXT_PROFILE_ES: int
|
||||
GL_CONTEXT_PROFILE_MASK: int
|
||||
GL_CONTEXT_RELEASE_BEHAVIOR: int
|
||||
GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH: int
|
||||
GL_CONTEXT_RELEASE_BEHAVIOR_NONE: int
|
||||
GL_CONTEXT_RESET_ISOLATION_FLAG: int
|
||||
GL_CONTEXT_ROBUST_ACCESS_FLAG: int
|
||||
GL_DEPTH_SIZE: int
|
||||
GL_DOUBLEBUFFER: int
|
||||
GL_FRAMEBUFFER_SRGB_CAPABLE: int
|
||||
GL_GREEN_SIZE: int
|
||||
GL_MULTISAMPLEBUFFERS: int
|
||||
GL_MULTISAMPLESAMPLES: int
|
||||
GL_RED_SIZE: int
|
||||
GL_SHARE_WITH_CURRENT_CONTEXT: int
|
||||
GL_STENCIL_SIZE: int
|
||||
GL_STEREO: int
|
||||
GL_SWAP_CONTROL: int
|
||||
HAT_CENTERED: int
|
||||
HAT_DOWN: int
|
||||
HAT_LEFT: int
|
||||
HAT_LEFTDOWN: int
|
||||
HAT_LEFTUP: int
|
||||
HAT_RIGHT: int
|
||||
HAT_RIGHTDOWN: int
|
||||
HAT_RIGHTUP: int
|
||||
HAT_UP: int
|
||||
HIDDEN: int
|
||||
HWACCEL: int
|
||||
HWPALETTE: int
|
||||
HWSURFACE: int
|
||||
JOYAXISMOTION: int
|
||||
JOYBALLMOTION: int
|
||||
JOYBUTTONDOWN: int
|
||||
JOYBUTTONUP: int
|
||||
JOYDEVICEADDED: int
|
||||
JOYDEVICEREMOVED: int
|
||||
JOYHATMOTION: int
|
||||
KEYDOWN: int
|
||||
KEYUP: int
|
||||
KMOD_ALT: int
|
||||
KMOD_CAPS: int
|
||||
KMOD_CTRL: int
|
||||
KMOD_GUI: int
|
||||
KMOD_LALT: int
|
||||
KMOD_LCTRL: int
|
||||
KMOD_LGUI: int
|
||||
KMOD_LMETA: int
|
||||
KMOD_LSHIFT: int
|
||||
KMOD_META: int
|
||||
KMOD_MODE: int
|
||||
KMOD_NONE: int
|
||||
KMOD_NUM: int
|
||||
KMOD_RALT: int
|
||||
KMOD_RCTRL: int
|
||||
KMOD_RGUI: int
|
||||
KMOD_RMETA: int
|
||||
KMOD_RSHIFT: int
|
||||
KMOD_SHIFT: int
|
||||
KSCAN_0: int
|
||||
KSCAN_1: int
|
||||
KSCAN_2: int
|
||||
KSCAN_3: int
|
||||
KSCAN_4: int
|
||||
KSCAN_5: int
|
||||
KSCAN_6: int
|
||||
KSCAN_7: int
|
||||
KSCAN_8: int
|
||||
KSCAN_9: int
|
||||
KSCAN_A: int
|
||||
KSCAN_APOSTROPHE: int
|
||||
KSCAN_B: int
|
||||
KSCAN_BACKSLASH: int
|
||||
KSCAN_BACKSPACE: int
|
||||
KSCAN_BREAK: int
|
||||
KSCAN_C: int
|
||||
KSCAN_CAPSLOCK: int
|
||||
KSCAN_CLEAR: int
|
||||
KSCAN_COMMA: int
|
||||
KSCAN_CURRENCYSUBUNIT: int
|
||||
KSCAN_CURRENCYUNIT: int
|
||||
KSCAN_D: int
|
||||
KSCAN_DELETE: int
|
||||
KSCAN_DOWN: int
|
||||
KSCAN_E: int
|
||||
KSCAN_END: int
|
||||
KSCAN_EQUALS: int
|
||||
KSCAN_ESCAPE: int
|
||||
KSCAN_EURO: int
|
||||
KSCAN_F: int
|
||||
KSCAN_F1: int
|
||||
KSCAN_F10: int
|
||||
KSCAN_F11: int
|
||||
KSCAN_F12: int
|
||||
KSCAN_F13: int
|
||||
KSCAN_F14: int
|
||||
KSCAN_F15: int
|
||||
KSCAN_F2: int
|
||||
KSCAN_F3: int
|
||||
KSCAN_F4: int
|
||||
KSCAN_F5: int
|
||||
KSCAN_F6: int
|
||||
KSCAN_F7: int
|
||||
KSCAN_F8: int
|
||||
KSCAN_F9: int
|
||||
KSCAN_G: int
|
||||
KSCAN_GRAVE: int
|
||||
KSCAN_H: int
|
||||
KSCAN_HELP: int
|
||||
KSCAN_HOME: int
|
||||
KSCAN_I: int
|
||||
KSCAN_INSERT: int
|
||||
KSCAN_INTERNATIONAL1: int
|
||||
KSCAN_INTERNATIONAL2: int
|
||||
KSCAN_INTERNATIONAL3: int
|
||||
KSCAN_INTERNATIONAL4: int
|
||||
KSCAN_INTERNATIONAL5: int
|
||||
KSCAN_INTERNATIONAL6: int
|
||||
KSCAN_INTERNATIONAL7: int
|
||||
KSCAN_INTERNATIONAL8: int
|
||||
KSCAN_INTERNATIONAL9: int
|
||||
KSCAN_J: int
|
||||
KSCAN_K: int
|
||||
KSCAN_KP0: int
|
||||
KSCAN_KP1: int
|
||||
KSCAN_KP2: int
|
||||
KSCAN_KP3: int
|
||||
KSCAN_KP4: int
|
||||
KSCAN_KP5: int
|
||||
KSCAN_KP6: int
|
||||
KSCAN_KP7: int
|
||||
KSCAN_KP8: int
|
||||
KSCAN_KP9: int
|
||||
KSCAN_KP_0: int
|
||||
KSCAN_KP_1: int
|
||||
KSCAN_KP_2: int
|
||||
KSCAN_KP_3: int
|
||||
KSCAN_KP_4: int
|
||||
KSCAN_KP_5: int
|
||||
KSCAN_KP_6: int
|
||||
KSCAN_KP_7: int
|
||||
KSCAN_KP_8: int
|
||||
KSCAN_KP_9: int
|
||||
KSCAN_KP_DIVIDE: int
|
||||
KSCAN_KP_ENTER: int
|
||||
KSCAN_KP_EQUALS: int
|
||||
KSCAN_KP_MINUS: int
|
||||
KSCAN_KP_MULTIPLY: int
|
||||
KSCAN_KP_PERIOD: int
|
||||
KSCAN_KP_PLUS: int
|
||||
KSCAN_L: int
|
||||
KSCAN_LALT: int
|
||||
KSCAN_LANG1: int
|
||||
KSCAN_LANG2: int
|
||||
KSCAN_LANG3: int
|
||||
KSCAN_LANG4: int
|
||||
KSCAN_LANG5: int
|
||||
KSCAN_LANG6: int
|
||||
KSCAN_LANG7: int
|
||||
KSCAN_LANG8: int
|
||||
KSCAN_LANG9: int
|
||||
KSCAN_LCTRL: int
|
||||
KSCAN_LEFT: int
|
||||
KSCAN_LEFTBRACKET: int
|
||||
KSCAN_LGUI: int
|
||||
KSCAN_LMETA: int
|
||||
KSCAN_LSHIFT: int
|
||||
KSCAN_LSUPER: int
|
||||
KSCAN_M: int
|
||||
KSCAN_MENU: int
|
||||
KSCAN_MINUS: int
|
||||
KSCAN_MODE: int
|
||||
KSCAN_N: int
|
||||
KSCAN_NONUSBACKSLASH: int
|
||||
KSCAN_NONUSHASH: int
|
||||
KSCAN_NUMLOCK: int
|
||||
KSCAN_NUMLOCKCLEAR: int
|
||||
KSCAN_O: int
|
||||
KSCAN_P: int
|
||||
KSCAN_PAGEDOWN: int
|
||||
KSCAN_PAGEUP: int
|
||||
KSCAN_PAUSE: int
|
||||
KSCAN_PERIOD: int
|
||||
KSCAN_POWER: int
|
||||
KSCAN_PRINT: int
|
||||
KSCAN_PRINTSCREEN: int
|
||||
KSCAN_Q: int
|
||||
KSCAN_R: int
|
||||
KSCAN_RALT: int
|
||||
KSCAN_RCTRL: int
|
||||
KSCAN_RETURN: int
|
||||
KSCAN_RGUI: int
|
||||
KSCAN_RIGHT: int
|
||||
KSCAN_RIGHTBRACKET: int
|
||||
KSCAN_RMETA: int
|
||||
KSCAN_RSHIFT: int
|
||||
KSCAN_RSUPER: int
|
||||
KSCAN_S: int
|
||||
KSCAN_SCROLLLOCK: int
|
||||
KSCAN_SCROLLOCK: int
|
||||
KSCAN_SEMICOLON: int
|
||||
KSCAN_SLASH: int
|
||||
KSCAN_SPACE: int
|
||||
KSCAN_SYSREQ: int
|
||||
KSCAN_T: int
|
||||
KSCAN_TAB: int
|
||||
KSCAN_U: int
|
||||
KSCAN_UNKNOWN: int
|
||||
KSCAN_UP: int
|
||||
KSCAN_V: int
|
||||
KSCAN_W: int
|
||||
KSCAN_X: int
|
||||
KSCAN_Y: int
|
||||
KSCAN_Z: int
|
||||
K_0: int
|
||||
K_1: int
|
||||
K_2: int
|
||||
K_3: int
|
||||
K_4: int
|
||||
K_5: int
|
||||
K_6: int
|
||||
K_7: int
|
||||
K_8: int
|
||||
K_9: int
|
||||
K_AC_BACK: int
|
||||
K_AMPERSAND: int
|
||||
K_ASTERISK: int
|
||||
K_AT: int
|
||||
K_BACKQUOTE: int
|
||||
K_BACKSLASH: int
|
||||
K_BACKSPACE: int
|
||||
K_BREAK: int
|
||||
K_CAPSLOCK: int
|
||||
K_CARET: int
|
||||
K_CLEAR: int
|
||||
K_COLON: int
|
||||
K_COMMA: int
|
||||
K_CURRENCYSUBUNIT: int
|
||||
K_CURRENCYUNIT: int
|
||||
K_DELETE: int
|
||||
K_DOLLAR: int
|
||||
K_DOWN: int
|
||||
K_END: int
|
||||
K_EQUALS: int
|
||||
K_ESCAPE: int
|
||||
K_EURO: int
|
||||
K_EXCLAIM: int
|
||||
K_F1: int
|
||||
K_F10: int
|
||||
K_F11: int
|
||||
K_F12: int
|
||||
K_F13: int
|
||||
K_F14: int
|
||||
K_F15: int
|
||||
K_F2: int
|
||||
K_F3: int
|
||||
K_F4: int
|
||||
K_F5: int
|
||||
K_F6: int
|
||||
K_F7: int
|
||||
K_F8: int
|
||||
K_F9: int
|
||||
K_GREATER: int
|
||||
K_HASH: int
|
||||
K_HELP: int
|
||||
K_HOME: int
|
||||
K_INSERT: int
|
||||
K_KP0: int
|
||||
K_KP1: int
|
||||
K_KP2: int
|
||||
K_KP3: int
|
||||
K_KP4: int
|
||||
K_KP5: int
|
||||
K_KP6: int
|
||||
K_KP7: int
|
||||
K_KP8: int
|
||||
K_KP9: int
|
||||
K_KP_0: int
|
||||
K_KP_1: int
|
||||
K_KP_2: int
|
||||
K_KP_3: int
|
||||
K_KP_4: int
|
||||
K_KP_5: int
|
||||
K_KP_6: int
|
||||
K_KP_7: int
|
||||
K_KP_8: int
|
||||
K_KP_9: int
|
||||
K_KP_DIVIDE: int
|
||||
K_KP_ENTER: int
|
||||
K_KP_EQUALS: int
|
||||
K_KP_MINUS: int
|
||||
K_KP_MULTIPLY: int
|
||||
K_KP_PERIOD: int
|
||||
K_KP_PLUS: int
|
||||
K_LALT: int
|
||||
K_LCTRL: int
|
||||
K_LEFT: int
|
||||
K_LEFTBRACKET: int
|
||||
K_LEFTPAREN: int
|
||||
K_LESS: int
|
||||
K_LGUI: int
|
||||
K_LMETA: int
|
||||
K_LSHIFT: int
|
||||
K_LSUPER: int
|
||||
K_MENU: int
|
||||
K_MINUS: int
|
||||
K_MODE: int
|
||||
K_NUMLOCK: int
|
||||
K_NUMLOCKCLEAR: int
|
||||
K_PAGEDOWN: int
|
||||
K_PAGEUP: int
|
||||
K_PAUSE: int
|
||||
K_PERCENT: int
|
||||
K_PERIOD: int
|
||||
K_PLUS: int
|
||||
K_POWER: int
|
||||
K_PRINT: int
|
||||
K_PRINTSCREEN: int
|
||||
K_QUESTION: int
|
||||
K_QUOTE: int
|
||||
K_QUOTEDBL: int
|
||||
K_RALT: int
|
||||
K_RCTRL: int
|
||||
K_RETURN: int
|
||||
K_RGUI: int
|
||||
K_RIGHT: int
|
||||
K_RIGHTBRACKET: int
|
||||
K_RIGHTPAREN: int
|
||||
K_RMETA: int
|
||||
K_RSHIFT: int
|
||||
K_RSUPER: int
|
||||
K_SCROLLLOCK: int
|
||||
K_SCROLLOCK: int
|
||||
K_SEMICOLON: int
|
||||
K_SLASH: int
|
||||
K_SPACE: int
|
||||
K_SYSREQ: int
|
||||
K_TAB: int
|
||||
K_UNDERSCORE: int
|
||||
K_UNKNOWN: int
|
||||
K_UP: int
|
||||
K_a: int
|
||||
K_b: int
|
||||
K_c: int
|
||||
K_d: int
|
||||
K_e: int
|
||||
K_f: int
|
||||
K_g: int
|
||||
K_h: int
|
||||
K_i: int
|
||||
K_j: int
|
||||
K_k: int
|
||||
K_l: int
|
||||
K_m: int
|
||||
K_n: int
|
||||
K_o: int
|
||||
K_p: int
|
||||
K_q: int
|
||||
K_r: int
|
||||
K_s: int
|
||||
K_t: int
|
||||
K_u: int
|
||||
K_v: int
|
||||
K_w: int
|
||||
K_x: int
|
||||
K_y: int
|
||||
K_z: int
|
||||
LIL_ENDIAN: int
|
||||
MIDIIN: int
|
||||
MIDIOUT: int
|
||||
MOUSEBUTTONDOWN: int
|
||||
MOUSEBUTTONUP: int
|
||||
MOUSEMOTION: int
|
||||
MOUSEWHEEL: int
|
||||
MULTIGESTURE: int
|
||||
NOEVENT: int
|
||||
NOFRAME: int
|
||||
NUMEVENTS: int
|
||||
OPENGL: int
|
||||
OPENGLBLIT: int
|
||||
PREALLOC: int
|
||||
QUIT: int
|
||||
RESIZABLE: int
|
||||
RLEACCEL: int
|
||||
RLEACCELOK: int
|
||||
SCALED: int
|
||||
SCRAP_BMP: str
|
||||
SCRAP_CLIPBOARD: int
|
||||
SCRAP_PBM: str
|
||||
SCRAP_PPM: str
|
||||
SCRAP_SELECTION: int
|
||||
SCRAP_TEXT: str
|
||||
SHOWN: int
|
||||
SRCALPHA: int
|
||||
SRCCOLORKEY: int
|
||||
SWSURFACE: int
|
||||
SYSTEM_CURSOR_ARROW: int
|
||||
SYSTEM_CURSOR_CROSSHAIR: int
|
||||
SYSTEM_CURSOR_HAND: int
|
||||
SYSTEM_CURSOR_IBEAM: int
|
||||
SYSTEM_CURSOR_NO: int
|
||||
SYSTEM_CURSOR_SIZEALL: int
|
||||
SYSTEM_CURSOR_SIZENESW: int
|
||||
SYSTEM_CURSOR_SIZENS: int
|
||||
SYSTEM_CURSOR_SIZENWSE: int
|
||||
SYSTEM_CURSOR_SIZEWE: int
|
||||
SYSTEM_CURSOR_WAIT: int
|
||||
SYSTEM_CURSOR_WAITARROW: int
|
||||
SYSWMEVENT: int
|
||||
TEXTEDITING: int
|
||||
TEXTINPUT: int
|
||||
TIMER_RESOLUTION: int
|
||||
USEREVENT: int
|
||||
USEREVENT_DROPFILE: int
|
||||
VIDEOEXPOSE: int
|
||||
VIDEORESIZE: int
|
||||
WINDOWCLOSE: int
|
||||
WINDOWENTER: int
|
||||
WINDOWEXPOSED: int
|
||||
WINDOWFOCUSGAINED: int
|
||||
WINDOWFOCUSLOST: int
|
||||
WINDOWHIDDEN: int
|
||||
WINDOWHITTEST: int
|
||||
WINDOWLEAVE: int
|
||||
WINDOWMAXIMIZED: int
|
||||
WINDOWMINIMIZED: int
|
||||
WINDOWMOVED: int
|
||||
WINDOWRESIZED: int
|
||||
WINDOWRESTORED: int
|
||||
WINDOWSHOWN: int
|
||||
WINDOWSIZECHANGED: int
|
||||
WINDOWTAKEFOCUS: int
|
||||
|
||||
__all__: List[str]
|
||||
840
.venv/lib/python3.8/site-packages/pygame/cursors.py
Normal file
|
|
@ -0,0 +1,840 @@
|
|||
# pygame - Python Game Library
|
||||
# Copyright (C) 2000-2003 Pete Shinners
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# Pete Shinners
|
||||
# pete@shinners.org
|
||||
|
||||
"""Set of cursor resources available for use. These cursors come
|
||||
in a sequence of values that are needed as the arguments for
|
||||
pygame.mouse.set_cursor(). To dereference the sequence in place
|
||||
and create the cursor in one step, call like this:
|
||||
pygame.mouse.set_cursor(*pygame.cursors.arrow).
|
||||
|
||||
Here is a list of available cursors:
|
||||
arrow, diamond, ball, broken_x, tri_left, tri_right
|
||||
|
||||
There is also a sample string cursor named 'thickarrow_strings'.
|
||||
The compile() function can convert these string cursors into cursor byte data that can be used to
|
||||
create Cursor objects.
|
||||
|
||||
Alternately, you can also create Cursor objects using surfaces or cursors constants,
|
||||
such as pygame.SYSTEM_CURSOR_ARROW.
|
||||
"""
|
||||
|
||||
import pygame
|
||||
|
||||
_cursor_id_table = {
|
||||
pygame.SYSTEM_CURSOR_ARROW: "SYSTEM_CURSOR_ARROW",
|
||||
pygame.SYSTEM_CURSOR_IBEAM: "SYSTEM_CURSOR_IBEAM",
|
||||
pygame.SYSTEM_CURSOR_WAIT: "SYSTEM_CURSOR_WAIT",
|
||||
pygame.SYSTEM_CURSOR_CROSSHAIR: "SYSTEM_CURSOR_CROSSHAIR",
|
||||
pygame.SYSTEM_CURSOR_WAITARROW: "SYSTEM_CURSOR_WAITARROW",
|
||||
pygame.SYSTEM_CURSOR_SIZENWSE: "SYSTEM_CURSOR_SIZENWSE",
|
||||
pygame.SYSTEM_CURSOR_SIZENESW: "SYSTEM_CURSOR_SIZENESW",
|
||||
pygame.SYSTEM_CURSOR_SIZEWE: "SYSTEM_CURSOR_SIZEWE",
|
||||
pygame.SYSTEM_CURSOR_SIZENS: "SYSTEM_CURSOR_SIZENS",
|
||||
pygame.SYSTEM_CURSOR_SIZEALL: "SYSTEM_CURSOR_SIZEALL",
|
||||
pygame.SYSTEM_CURSOR_NO: "SYSTEM_CURSOR_NO",
|
||||
pygame.SYSTEM_CURSOR_HAND: "SYSTEM_CURSOR_HAND",
|
||||
}
|
||||
|
||||
|
||||
class Cursor(object):
|
||||
def __init__(self, *args):
|
||||
"""Cursor(size, hotspot, xormasks, andmasks) -> Cursor
|
||||
Cursor(hotspot, Surface) -> Cursor
|
||||
Cursor(constant) -> Cursor
|
||||
Cursor(Cursor) -> copies the Cursor object passed as an argument
|
||||
Cursor() -> Cursor
|
||||
|
||||
pygame object for representing cursors
|
||||
|
||||
You can initialize a cursor from a system cursor or use the
|
||||
constructor on an existing Cursor object, which will copy it.
|
||||
Providing a Surface instance will render the cursor displayed
|
||||
as that Surface when used.
|
||||
|
||||
These Surfaces may use other colors than black and white."""
|
||||
if len(args) == 0:
|
||||
self.type = "system"
|
||||
self.data = (pygame.SYSTEM_CURSOR_ARROW,)
|
||||
elif len(args) == 1 and args[0] in _cursor_id_table:
|
||||
self.type = "system"
|
||||
self.data = (args[0],)
|
||||
elif len(args) == 1 and isinstance(args[0], Cursor):
|
||||
self.type = args[0].type
|
||||
self.data = args[0].data
|
||||
elif (
|
||||
len(args) == 2 and len(args[0]) == 2 and isinstance(args[1], pygame.Surface)
|
||||
):
|
||||
self.type = "color"
|
||||
self.data = tuple(args)
|
||||
elif len(args) == 4 and len(args[0]) == 2 and len(args[1]) == 2:
|
||||
self.type = "bitmap"
|
||||
# pylint: disable=consider-using-generator
|
||||
# See https://github.com/pygame/pygame/pull/2509 for analysis
|
||||
self.data = tuple([tuple(arg) for arg in args])
|
||||
else:
|
||||
raise TypeError("Arguments must match a cursor specification")
|
||||
|
||||
def __len__(self):
|
||||
return len(self.data)
|
||||
|
||||
def __getitem__(self, index):
|
||||
return self.data[index]
|
||||
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, Cursor) and self.data == other.data
|
||||
|
||||
def __ne__(self, other):
|
||||
return not self.__eq__(other)
|
||||
|
||||
def __copy__(self):
|
||||
"""Clone the current Cursor object.
|
||||
You can do the same thing by doing Cursor(Cursor)."""
|
||||
return self.__class__(self)
|
||||
|
||||
copy = __copy__
|
||||
|
||||
def __hash__(self):
|
||||
return hash(tuple([self.type] + list(self.data)))
|
||||
|
||||
def __repr__(self):
|
||||
if self.type == "system":
|
||||
id_string = _cursor_id_table.get(self.data[0], "constant lookup error")
|
||||
return "<Cursor(type: system, constant: " + id_string + ")>"
|
||||
if self.type == "bitmap":
|
||||
size = "size: " + str(self.data[0])
|
||||
hotspot = "hotspot: " + str(self.data[1])
|
||||
return "<Cursor(type: bitmap, " + size + ", " + hotspot + ")>"
|
||||
if self.type == "color":
|
||||
hotspot = "hotspot: " + str(self.data[0])
|
||||
surf = repr(self.data[1])
|
||||
return "<Cursor(type: color, " + hotspot + ", surf: " + surf + ")>"
|
||||
raise TypeError("Invalid Cursor")
|
||||
|
||||
|
||||
# Python side of the set_cursor function: C side in mouse.c
|
||||
def set_cursor(*args):
|
||||
"""set_cursor(pygame.cursors.Cursor OR args for a pygame.cursors.Cursor) -> None
|
||||
set the mouse cursor to a new cursor"""
|
||||
cursor = Cursor(*args)
|
||||
pygame.mouse._set_cursor(**{cursor.type: cursor.data})
|
||||
|
||||
|
||||
pygame.mouse.set_cursor = set_cursor
|
||||
del set_cursor # cleanup namespace
|
||||
|
||||
# Python side of the get_cursor function: C side in mouse.c
|
||||
def get_cursor():
|
||||
"""get_cursor() -> pygame.cursors.Cursor
|
||||
get the current mouse cursor"""
|
||||
return Cursor(*pygame.mouse._get_cursor())
|
||||
|
||||
|
||||
pygame.mouse.get_cursor = get_cursor
|
||||
del get_cursor # cleanup namespace
|
||||
|
||||
arrow = Cursor(
|
||||
(16, 16),
|
||||
(0, 0),
|
||||
(
|
||||
0x00,
|
||||
0x00,
|
||||
0x40,
|
||||
0x00,
|
||||
0x60,
|
||||
0x00,
|
||||
0x70,
|
||||
0x00,
|
||||
0x78,
|
||||
0x00,
|
||||
0x7C,
|
||||
0x00,
|
||||
0x7E,
|
||||
0x00,
|
||||
0x7F,
|
||||
0x00,
|
||||
0x7F,
|
||||
0x80,
|
||||
0x7C,
|
||||
0x00,
|
||||
0x6C,
|
||||
0x00,
|
||||
0x46,
|
||||
0x00,
|
||||
0x06,
|
||||
0x00,
|
||||
0x03,
|
||||
0x00,
|
||||
0x03,
|
||||
0x00,
|
||||
0x00,
|
||||
0x00,
|
||||
),
|
||||
(
|
||||
0x40,
|
||||
0x00,
|
||||
0xE0,
|
||||
0x00,
|
||||
0xF0,
|
||||
0x00,
|
||||
0xF8,
|
||||
0x00,
|
||||
0xFC,
|
||||
0x00,
|
||||
0xFE,
|
||||
0x00,
|
||||
0xFF,
|
||||
0x00,
|
||||
0xFF,
|
||||
0x80,
|
||||
0xFF,
|
||||
0xC0,
|
||||
0xFF,
|
||||
0x80,
|
||||
0xFE,
|
||||
0x00,
|
||||
0xEF,
|
||||
0x00,
|
||||
0x4F,
|
||||
0x00,
|
||||
0x07,
|
||||
0x80,
|
||||
0x07,
|
||||
0x80,
|
||||
0x03,
|
||||
0x00,
|
||||
),
|
||||
)
|
||||
|
||||
diamond = Cursor(
|
||||
(16, 16),
|
||||
(7, 7),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
3,
|
||||
128,
|
||||
7,
|
||||
192,
|
||||
14,
|
||||
224,
|
||||
28,
|
||||
112,
|
||||
56,
|
||||
56,
|
||||
112,
|
||||
28,
|
||||
56,
|
||||
56,
|
||||
28,
|
||||
112,
|
||||
14,
|
||||
224,
|
||||
7,
|
||||
192,
|
||||
3,
|
||||
128,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
),
|
||||
(
|
||||
1,
|
||||
0,
|
||||
3,
|
||||
128,
|
||||
7,
|
||||
192,
|
||||
15,
|
||||
224,
|
||||
31,
|
||||
240,
|
||||
62,
|
||||
248,
|
||||
124,
|
||||
124,
|
||||
248,
|
||||
62,
|
||||
124,
|
||||
124,
|
||||
62,
|
||||
248,
|
||||
31,
|
||||
240,
|
||||
15,
|
||||
224,
|
||||
7,
|
||||
192,
|
||||
3,
|
||||
128,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
),
|
||||
)
|
||||
|
||||
ball = Cursor(
|
||||
(16, 16),
|
||||
(7, 7),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
192,
|
||||
15,
|
||||
240,
|
||||
24,
|
||||
248,
|
||||
51,
|
||||
252,
|
||||
55,
|
||||
252,
|
||||
127,
|
||||
254,
|
||||
127,
|
||||
254,
|
||||
127,
|
||||
254,
|
||||
127,
|
||||
254,
|
||||
63,
|
||||
252,
|
||||
63,
|
||||
252,
|
||||
31,
|
||||
248,
|
||||
15,
|
||||
240,
|
||||
3,
|
||||
192,
|
||||
0,
|
||||
0,
|
||||
),
|
||||
(
|
||||
3,
|
||||
192,
|
||||
15,
|
||||
240,
|
||||
31,
|
||||
248,
|
||||
63,
|
||||
252,
|
||||
127,
|
||||
254,
|
||||
127,
|
||||
254,
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
127,
|
||||
254,
|
||||
127,
|
||||
254,
|
||||
63,
|
||||
252,
|
||||
31,
|
||||
248,
|
||||
15,
|
||||
240,
|
||||
3,
|
||||
192,
|
||||
),
|
||||
)
|
||||
|
||||
broken_x = Cursor(
|
||||
(16, 16),
|
||||
(7, 7),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
96,
|
||||
6,
|
||||
112,
|
||||
14,
|
||||
56,
|
||||
28,
|
||||
28,
|
||||
56,
|
||||
12,
|
||||
48,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
12,
|
||||
48,
|
||||
28,
|
||||
56,
|
||||
56,
|
||||
28,
|
||||
112,
|
||||
14,
|
||||
96,
|
||||
6,
|
||||
0,
|
||||
0,
|
||||
),
|
||||
(
|
||||
224,
|
||||
7,
|
||||
240,
|
||||
15,
|
||||
248,
|
||||
31,
|
||||
124,
|
||||
62,
|
||||
62,
|
||||
124,
|
||||
30,
|
||||
120,
|
||||
14,
|
||||
112,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
14,
|
||||
112,
|
||||
30,
|
||||
120,
|
||||
62,
|
||||
124,
|
||||
124,
|
||||
62,
|
||||
248,
|
||||
31,
|
||||
240,
|
||||
15,
|
||||
224,
|
||||
7,
|
||||
),
|
||||
)
|
||||
|
||||
tri_left = Cursor(
|
||||
(16, 16),
|
||||
(1, 1),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
96,
|
||||
0,
|
||||
120,
|
||||
0,
|
||||
62,
|
||||
0,
|
||||
63,
|
||||
128,
|
||||
31,
|
||||
224,
|
||||
31,
|
||||
248,
|
||||
15,
|
||||
254,
|
||||
15,
|
||||
254,
|
||||
7,
|
||||
128,
|
||||
7,
|
||||
128,
|
||||
3,
|
||||
128,
|
||||
3,
|
||||
128,
|
||||
1,
|
||||
128,
|
||||
1,
|
||||
128,
|
||||
0,
|
||||
0,
|
||||
),
|
||||
(
|
||||
224,
|
||||
0,
|
||||
248,
|
||||
0,
|
||||
254,
|
||||
0,
|
||||
127,
|
||||
128,
|
||||
127,
|
||||
224,
|
||||
63,
|
||||
248,
|
||||
63,
|
||||
254,
|
||||
31,
|
||||
255,
|
||||
31,
|
||||
255,
|
||||
15,
|
||||
254,
|
||||
15,
|
||||
192,
|
||||
7,
|
||||
192,
|
||||
7,
|
||||
192,
|
||||
3,
|
||||
192,
|
||||
3,
|
||||
192,
|
||||
1,
|
||||
128,
|
||||
),
|
||||
)
|
||||
|
||||
tri_right = Cursor(
|
||||
(16, 16),
|
||||
(14, 1),
|
||||
(
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
6,
|
||||
0,
|
||||
30,
|
||||
0,
|
||||
124,
|
||||
1,
|
||||
252,
|
||||
7,
|
||||
248,
|
||||
31,
|
||||
248,
|
||||
127,
|
||||
240,
|
||||
127,
|
||||
240,
|
||||
1,
|
||||
224,
|
||||
1,
|
||||
224,
|
||||
1,
|
||||
192,
|
||||
1,
|
||||
192,
|
||||
1,
|
||||
128,
|
||||
1,
|
||||
128,
|
||||
0,
|
||||
0,
|
||||
),
|
||||
(
|
||||
0,
|
||||
7,
|
||||
0,
|
||||
31,
|
||||
0,
|
||||
127,
|
||||
1,
|
||||
254,
|
||||
7,
|
||||
254,
|
||||
31,
|
||||
252,
|
||||
127,
|
||||
252,
|
||||
255,
|
||||
248,
|
||||
255,
|
||||
248,
|
||||
127,
|
||||
240,
|
||||
3,
|
||||
240,
|
||||
3,
|
||||
224,
|
||||
3,
|
||||
224,
|
||||
3,
|
||||
192,
|
||||
3,
|
||||
192,
|
||||
1,
|
||||
128,
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
# Here is an example string resource cursor. To use this:
|
||||
# curs, mask = pygame.cursors.compile_cursor(pygame.cursors.thickarrow_strings, 'X', '.')
|
||||
# pygame.mouse.set_cursor((24, 24), (0, 0), curs, mask)
|
||||
# Be warned, though, that cursors created from compiled strings do not support colors.
|
||||
|
||||
# sized 24x24
|
||||
thickarrow_strings = (
|
||||
"XX ",
|
||||
"XXX ",
|
||||
"XXXX ",
|
||||
"XX.XX ",
|
||||
"XX..XX ",
|
||||
"XX...XX ",
|
||||
"XX....XX ",
|
||||
"XX.....XX ",
|
||||
"XX......XX ",
|
||||
"XX.......XX ",
|
||||
"XX........XX ",
|
||||
"XX........XXX ",
|
||||
"XX......XXXXX ",
|
||||
"XX.XXX..XX ",
|
||||
"XXXX XX..XX ",
|
||||
"XX XX..XX ",
|
||||
" XX..XX ",
|
||||
" XX..XX ",
|
||||
" XX..XX ",
|
||||
" XXXX ",
|
||||
" XX ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
)
|
||||
|
||||
# sized 24x16
|
||||
sizer_x_strings = (
|
||||
" X X ",
|
||||
" XX XX ",
|
||||
" X.X X.X ",
|
||||
" X..X X..X ",
|
||||
" X...XXXXXXXX...X ",
|
||||
"X................X ",
|
||||
" X...XXXXXXXX...X ",
|
||||
" X..X X..X ",
|
||||
" X.X X.X ",
|
||||
" XX XX ",
|
||||
" X X ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
)
|
||||
|
||||
# sized 16x24
|
||||
sizer_y_strings = (
|
||||
" X ",
|
||||
" X.X ",
|
||||
" X...X ",
|
||||
" X.....X ",
|
||||
" X.......X ",
|
||||
"XXXXX.XXXXX ",
|
||||
" X.X ",
|
||||
" X.X ",
|
||||
" X.X ",
|
||||
" X.X ",
|
||||
" X.X ",
|
||||
" X.X ",
|
||||
" X.X ",
|
||||
"XXXXX.XXXXX ",
|
||||
" X.......X ",
|
||||
" X.....X ",
|
||||
" X...X ",
|
||||
" X.X ",
|
||||
" X ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
)
|
||||
|
||||
# sized 24x16
|
||||
sizer_xy_strings = (
|
||||
"XXXXXXXX ",
|
||||
"X.....X ",
|
||||
"X....X ",
|
||||
"X...X ",
|
||||
"X..X.X ",
|
||||
"X.X X.X ",
|
||||
"XX X.X X ",
|
||||
"X X.X XX ",
|
||||
" X.XX.X ",
|
||||
" X...X ",
|
||||
" X...X ",
|
||||
" X....X ",
|
||||
" X.....X ",
|
||||
" XXXXXXXX ",
|
||||
" ",
|
||||
" ",
|
||||
)
|
||||
|
||||
# sized 8x16
|
||||
textmarker_strings = (
|
||||
"ooo ooo ",
|
||||
" o ",
|
||||
" o ",
|
||||
" o ",
|
||||
" o ",
|
||||
" o ",
|
||||
" o ",
|
||||
" o ",
|
||||
" o ",
|
||||
" o ",
|
||||
" o ",
|
||||
"ooo ooo ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
)
|
||||
|
||||
|
||||
def compile(strings, black="X", white=".", xor="o"):
|
||||
"""pygame.cursors.compile(strings, black, white, xor) -> data, mask
|
||||
compile cursor strings into cursor data
|
||||
|
||||
This takes a set of strings with equal length and computes
|
||||
the binary data for that cursor. The string widths must be
|
||||
divisible by 8.
|
||||
|
||||
The black and white arguments are single letter strings that
|
||||
tells which characters will represent black pixels, and which
|
||||
characters represent white pixels. All other characters are
|
||||
considered clear.
|
||||
|
||||
Some systems allow you to set a special toggle color for the
|
||||
system color, this is also called the xor color. If the system
|
||||
does not support xor cursors, that color will simply be black.
|
||||
|
||||
This returns a tuple containing the cursor data and cursor mask
|
||||
data. Both these arguments are used when setting a cursor with
|
||||
pygame.mouse.set_cursor().
|
||||
"""
|
||||
# first check for consistent lengths
|
||||
size = len(strings[0]), len(strings)
|
||||
if size[0] % 8 or size[1] % 8:
|
||||
raise ValueError(f"cursor string sizes must be divisible by 8 {size}")
|
||||
|
||||
for s in strings[1:]:
|
||||
if len(s) != size[0]:
|
||||
raise ValueError("Cursor strings are inconsistent lengths")
|
||||
|
||||
# create the data arrays.
|
||||
# this could stand a little optimizing
|
||||
maskdata = []
|
||||
filldata = []
|
||||
maskitem = fillitem = 0
|
||||
step = 8
|
||||
for s in strings:
|
||||
for c in s:
|
||||
maskitem = maskitem << 1
|
||||
fillitem = fillitem << 1
|
||||
step = step - 1
|
||||
if c == black:
|
||||
maskitem = maskitem | 1
|
||||
fillitem = fillitem | 1
|
||||
elif c == white:
|
||||
maskitem = maskitem | 1
|
||||
elif c == xor:
|
||||
fillitem = fillitem | 1
|
||||
|
||||
if not step:
|
||||
maskdata.append(maskitem)
|
||||
filldata.append(fillitem)
|
||||
maskitem = fillitem = 0
|
||||
step = 8
|
||||
|
||||
return tuple(filldata), tuple(maskdata)
|
||||
|
||||
|
||||
def load_xbm(curs, mask):
|
||||
"""pygame.cursors.load_xbm(cursorfile, maskfile) -> cursor_args
|
||||
reads a pair of XBM files into set_cursor arguments
|
||||
|
||||
Arguments can either be filenames or filelike objects
|
||||
with the readlines method. Not largely tested, but
|
||||
should work with typical XBM files.
|
||||
"""
|
||||
|
||||
def bitswap(num):
|
||||
val = 0
|
||||
for x in range(8):
|
||||
b = num & (1 << x) != 0
|
||||
val = val << 1 | b
|
||||
return val
|
||||
|
||||
if hasattr(curs, "readlines"):
|
||||
curs = curs.readlines()
|
||||
else:
|
||||
with open(curs, encoding="ascii") as cursor_f:
|
||||
curs = cursor_f.readlines()
|
||||
|
||||
if hasattr(mask, "readlines"):
|
||||
mask = mask.readlines()
|
||||
else:
|
||||
with open(mask, encoding="ascii") as mask_f:
|
||||
mask = mask_f.readlines()
|
||||
|
||||
# avoid comments
|
||||
for i, line in enumerate(curs):
|
||||
if line.startswith("#define"):
|
||||
curs = curs[i:]
|
||||
break
|
||||
|
||||
for i, line in enumerate(mask):
|
||||
if line.startswith("#define"):
|
||||
mask = mask[i:]
|
||||
break
|
||||
|
||||
# load width,height
|
||||
width = int(curs[0].split()[-1])
|
||||
height = int(curs[1].split()[-1])
|
||||
# load hotspot position
|
||||
if curs[2].startswith("#define"):
|
||||
hotx = int(curs[2].split()[-1])
|
||||
hoty = int(curs[3].split()[-1])
|
||||
else:
|
||||
hotx = hoty = 0
|
||||
|
||||
info = width, height, hotx, hoty
|
||||
|
||||
possible_starts = ("static char", "static unsigned char")
|
||||
for i, line in enumerate(curs):
|
||||
if line.startswith(possible_starts):
|
||||
break
|
||||
data = " ".join(curs[i + 1 :]).replace("};", "").replace(",", " ")
|
||||
cursdata = []
|
||||
for x in data.split():
|
||||
cursdata.append(bitswap(int(x, 16)))
|
||||
cursdata = tuple(cursdata)
|
||||
for i, line in enumerate(mask):
|
||||
if line.startswith(possible_starts):
|
||||
break
|
||||
data = " ".join(mask[i + 1 :]).replace("};", "").replace(",", " ")
|
||||
maskdata = []
|
||||
for x in data.split():
|
||||
maskdata.append(bitswap(int(x, 16)))
|
||||
|
||||
maskdata = tuple(maskdata)
|
||||
return info[:2], info[2:], cursdata, maskdata
|
||||
86
.venv/lib/python3.8/site-packages/pygame/cursors.pyi
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
from typing import Iterator, List, Tuple, Sequence, Iterable, Union, overload
|
||||
|
||||
from pygame.surface import Surface
|
||||
|
||||
_Small_string = Tuple[
|
||||
str, str, str, str, str, str, str, str, str, str, str, str, str, str, str, str
|
||||
]
|
||||
_Big_string = Tuple[
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
str,
|
||||
]
|
||||
|
||||
arrow: Cursor
|
||||
diamond: Cursor
|
||||
broken_x: Cursor
|
||||
tri_left: Cursor
|
||||
tri_right: Cursor
|
||||
thickarrow_strings: _Big_string
|
||||
sizer_x_strings: _Small_string
|
||||
sizer_y_strings: _Big_string
|
||||
sizer_xy_strings: _Small_string
|
||||
|
||||
def compile(
|
||||
strings: Sequence[str],
|
||||
black: str = "X",
|
||||
white: str = ".",
|
||||
xor: str = "o",
|
||||
) -> Tuple[Sequence[int], Sequence[int]]: ...
|
||||
def load_xbm(
|
||||
cursorfile: str, maskfile: str
|
||||
) -> Tuple[List[int], List[int], Tuple[int, ...], Tuple[int, ...]]: ...
|
||||
|
||||
class Cursor(Iterable[object]):
|
||||
@overload
|
||||
def __init__(self, constant: int = ...) -> None: ...
|
||||
@overload
|
||||
def __init__(self, cursor: Cursor) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
size: Union[Tuple[int, int], List[int]],
|
||||
hotspot: Union[Tuple[int, int], List[int]],
|
||||
xormasks: Sequence[int],
|
||||
andmasks: Sequence[int],
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
hotspot: Union[Tuple[int, int], List[int]],
|
||||
surface: Surface,
|
||||
) -> None: ...
|
||||
def __iter__(self) -> Iterator[object]: ...
|
||||
def __len__(self) -> int: ...
|
||||
type: str
|
||||
data: Union[
|
||||
Tuple[int],
|
||||
Tuple[
|
||||
Union[Tuple[int, int], List[int]],
|
||||
Union[Tuple[int, int], List[int]],
|
||||
Sequence[int],
|
||||
Sequence[int],
|
||||
],
|
||||
Tuple[int, Surface],
|
||||
]
|
||||
BIN
.venv/lib/python3.8/site-packages/pygame/display.cpython-38-x86_64-linux-gnu.so
Executable file
68
.venv/lib/python3.8/site-packages/pygame/display.pyi
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
from typing import Union, Tuple, List, Optional, Dict, Sequence
|
||||
|
||||
from pygame.surface import Surface
|
||||
from pygame.constants import FULLSCREEN
|
||||
from ._common import _Coordinate, _RectValue, _ColorValue, _RgbaOutput
|
||||
|
||||
class _VidInfo:
|
||||
hw: int
|
||||
wm: int
|
||||
video_mem: int
|
||||
bitsize: int
|
||||
bytesize: int
|
||||
masks: _RgbaOutput
|
||||
shifts: _RgbaOutput
|
||||
losses: _RgbaOutput
|
||||
blit_hw: int
|
||||
blit_hw_CC: int
|
||||
blit_hw_A: int
|
||||
blit_sw: int
|
||||
blit_sw_CC: int
|
||||
blit_sw_A: int
|
||||
current_h: int
|
||||
current_w: int
|
||||
|
||||
def init() -> None: ...
|
||||
def quit() -> None: ...
|
||||
def get_init() -> bool: ...
|
||||
def set_mode(
|
||||
size: _Coordinate = (0, 0),
|
||||
flags: int = 0,
|
||||
depth: int = 0,
|
||||
display: int = 0,
|
||||
vsync: int = 0,
|
||||
) -> Surface: ...
|
||||
def get_surface() -> Surface: ...
|
||||
def flip() -> None: ...
|
||||
def update(rectangle: Optional[Union[_RectValue, List[_RectValue]]] = None) -> None: ...
|
||||
def get_driver() -> str: ...
|
||||
def Info() -> _VidInfo: ...
|
||||
def get_wm_info() -> Dict[str, int]: ...
|
||||
def list_modes(
|
||||
depth: int = 0,
|
||||
flags: int = FULLSCREEN,
|
||||
display: int = 0,
|
||||
) -> List[Tuple[int, int]]: ...
|
||||
def mode_ok(
|
||||
size: Union[Sequence[int], Tuple[int, int]],
|
||||
flags: int = 0,
|
||||
depth: int = 0,
|
||||
display: int = 0,
|
||||
) -> int: ...
|
||||
def gl_get_attribute(flag: int) -> int: ...
|
||||
def gl_set_attribute(flag: int, value: int) -> None: ...
|
||||
def get_active() -> bool: ...
|
||||
def iconify() -> bool: ...
|
||||
def toggle_fullscreen() -> int: ...
|
||||
def set_gamma(red: float, green: float = ..., blue: float = ...) -> int: ...
|
||||
def set_gamma_ramp(
|
||||
red: Sequence[int], green: Sequence[int], blue: Sequence[int]
|
||||
) -> int: ...
|
||||
def set_icon(surface: Surface) -> None: ...
|
||||
def set_caption(title: str, icontitle: Optional[str] = None) -> None: ...
|
||||
def get_caption() -> Tuple[str, str]: ...
|
||||
def set_palette(palette: Sequence[_ColorValue]) -> None: ...
|
||||
def get_num_displays() -> int: ...
|
||||
def get_window_size() -> Tuple[int, int]: ...
|
||||
def get_allow_screensaver() -> bool: ...
|
||||
def set_allow_screensaver(value: bool = True) -> None: ...
|
||||
38
.venv/lib/python3.8/site-packages/pygame/docs/__main__.py
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# python -m pygame.docs
|
||||
|
||||
import os
|
||||
import webbrowser
|
||||
from urllib.parse import quote, urlunparse
|
||||
|
||||
|
||||
def _iterpath(path):
|
||||
path, last = os.path.split(path)
|
||||
if last:
|
||||
for p in _iterpath(path):
|
||||
yield p
|
||||
yield last
|
||||
|
||||
|
||||
# for test suite to confirm pygame built with local docs
|
||||
def has_local_docs():
|
||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
main_page = os.path.join(pkg_dir, "generated", "index.html")
|
||||
return os.path.exists(main_page)
|
||||
|
||||
|
||||
def open_docs():
|
||||
pkg_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
main_page = os.path.join(pkg_dir, "generated", "index.html")
|
||||
if os.path.exists(main_page):
|
||||
url_path = quote("/".join(_iterpath(main_page)))
|
||||
drive, rest = os.path.splitdrive(__file__)
|
||||
if drive:
|
||||
url_path = "%s/%s" % (drive, url_path)
|
||||
url = urlunparse(("file", "", url_path, "", "", ""))
|
||||
else:
|
||||
url = "https://www.pygame.org/docs/"
|
||||
webbrowser.open(url)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
open_docs()
|
||||
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 6.1 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 36 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
After Width: | Height: | Size: 20 KiB |