crystalwindow 3.8.4__tar.gz → 3.8.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {crystalwindow-3.8.4/crystalwindow.egg-info → crystalwindow-3.8.5}/PKG-INFO +1 -1
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/__init__.py +2 -1
- crystalwindow-3.8.5/crystalwindow/color_handler.py +123 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/gui.py +0 -4
- {crystalwindow-3.8.4 → crystalwindow-3.8.5/crystalwindow.egg-info}/PKG-INFO +1 -1
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow.egg-info/SOURCES.txt +1 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/setup.py +1 -1
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/LICENSE +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/MANIFEST.in +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/README.md +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/FileHelper.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/Icons/default_icon.png +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/animation.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/assets.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/camera.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/clock.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/collision.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/crystal3d.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/docs/getting_started.md +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/docs/index.md +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/draw_helpers.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/draw_rects.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/draw_text_helper.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/draw_tool.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/fun_helpers.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/gametests/3dsquare.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/gametests/__init__.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/gametests/__main__.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/gametests/gravitytest.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/gametests/guitesting.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/gametests/sandbox.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/gametests/squaremove.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/gametests/windowtesting.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/gravity.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/gui_ext.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/math.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/player.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/sprites.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/tilemap.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/ver_warner.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow/window.py +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow.egg-info/dependency_links.txt +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/crystalwindow.egg-info/top_level.txt +0 -0
- {crystalwindow-3.8.4 → crystalwindow-3.8.5}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crystalwindow
|
|
3
|
-
Version: 3.8.
|
|
3
|
+
Version: 3.8.5
|
|
4
4
|
Summary: A Tkinter powered window + GUI toolkit made by Crystal (MEEEEEE)! Easier apps, smoother UI and all-in-one helpers!
|
|
5
5
|
Home-page: https://pypi.org/project/crystalwindow/
|
|
6
6
|
Author: CrystalBallyHereXD
|
|
@@ -44,6 +44,7 @@ from .draw_tool import CrystalDraw
|
|
|
44
44
|
# === Misc Helpers ===
|
|
45
45
|
from .fun_helpers import random_name, DebugOverlay
|
|
46
46
|
from .camera import Camera
|
|
47
|
+
from .color_handler import Colors, Color
|
|
47
48
|
|
|
48
49
|
# === 3D Engine ===
|
|
49
50
|
from .crystal3d import CW3D
|
|
@@ -81,7 +82,7 @@ __all__ = [
|
|
|
81
82
|
"gradient_rect", "CameraShake", "DrawHelper", "DrawTextManager", "CrystalDraw",
|
|
82
83
|
|
|
83
84
|
# --- Misc ---
|
|
84
|
-
"random_name", "DebugOverlay", "Camera",
|
|
85
|
+
"random_name", "DebugOverlay", "Camera", "Colors", "Color",
|
|
85
86
|
|
|
86
87
|
# --- 3D ---
|
|
87
88
|
"CW3D",
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# --------------------------------------
|
|
2
|
+
# CrystalWindow Color System v2.0
|
|
3
|
+
# --------------------------------------
|
|
4
|
+
|
|
5
|
+
class Colors:
|
|
6
|
+
# BASIC COLORS
|
|
7
|
+
Black = (0, 0, 0)
|
|
8
|
+
White = (255, 255, 255)
|
|
9
|
+
Red = (255, 0, 0)
|
|
10
|
+
Green = (0, 255, 0)
|
|
11
|
+
Blue = (0, 0, 255)
|
|
12
|
+
Yellow = (255, 255, 0)
|
|
13
|
+
Cyan = (0, 255, 255)
|
|
14
|
+
Magenta = (255, 0, 255)
|
|
15
|
+
Gray = (120, 120, 120)
|
|
16
|
+
DarkGray = (40, 40, 40)
|
|
17
|
+
|
|
18
|
+
# CRYSTALWINDOW CUSTOM
|
|
19
|
+
CrystalBlue = (87, 199, 255)
|
|
20
|
+
Accent = (87, 199, 255)
|
|
21
|
+
Success = (76, 255, 111)
|
|
22
|
+
Error = (255, 68, 68)
|
|
23
|
+
Transparent = (0, 0, 0, 0) # full alpha
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class Color:
|
|
27
|
+
COLOR_NAMES = {name.lower(): value for name, value in Colors.__dict__.items()
|
|
28
|
+
if not name.startswith("__")}
|
|
29
|
+
|
|
30
|
+
def __init__(self, r=None, g=None, b=None, a=255, hex_value=None):
|
|
31
|
+
# -------------------------------------------------
|
|
32
|
+
# 1) raw tuple variable: Color(Blue)
|
|
33
|
+
# -------------------------------------------------
|
|
34
|
+
if isinstance(r, (tuple, list)):
|
|
35
|
+
if len(r) == 3: # rgb
|
|
36
|
+
self.r, self.g, self.b = r
|
|
37
|
+
self.a = a
|
|
38
|
+
elif len(r) == 4: # rgba
|
|
39
|
+
self.r, self.g, self.b, self.a = r
|
|
40
|
+
return
|
|
41
|
+
|
|
42
|
+
# -------------------------------------------------
|
|
43
|
+
# 2) name string: Color("blue")
|
|
44
|
+
# -------------------------------------------------
|
|
45
|
+
if isinstance(r, str):
|
|
46
|
+
name = r.lower()
|
|
47
|
+
if name not in self.COLOR_NAMES:
|
|
48
|
+
raise ValueError(f"unknown color name: {r}")
|
|
49
|
+
data = self.COLOR_NAMES[name]
|
|
50
|
+
if len(data) == 4:
|
|
51
|
+
self.r, self.g, self.b, self.a = data
|
|
52
|
+
else:
|
|
53
|
+
self.r, self.g, self.b = data
|
|
54
|
+
self.a = a
|
|
55
|
+
return
|
|
56
|
+
|
|
57
|
+
# -------------------------------------------------
|
|
58
|
+
# 3) HEX input
|
|
59
|
+
# -------------------------------------------------
|
|
60
|
+
if hex_value is not None:
|
|
61
|
+
self.r, self.g, self.b, self.a = self.hex_to_rgba(hex_value)
|
|
62
|
+
return
|
|
63
|
+
|
|
64
|
+
# -------------------------------------------------
|
|
65
|
+
# 4) manual RGB
|
|
66
|
+
# -------------------------------------------------
|
|
67
|
+
self.r = r or 0
|
|
68
|
+
self.g = g or 0
|
|
69
|
+
self.b = b or 0
|
|
70
|
+
self.a = a
|
|
71
|
+
|
|
72
|
+
# convert hex -> rgba
|
|
73
|
+
@staticmethod
|
|
74
|
+
def hex_to_rgba(hex_value: str):
|
|
75
|
+
hex_value = hex_value.replace("#", "")
|
|
76
|
+
if len(hex_value) == 6:
|
|
77
|
+
r = int(hex_value[0:2], 16)
|
|
78
|
+
g = int(hex_value[2:4], 16)
|
|
79
|
+
b = int(hex_value[4:6], 16)
|
|
80
|
+
a = 255
|
|
81
|
+
elif len(hex_value) == 8:
|
|
82
|
+
r = int(hex_value[0:2], 16)
|
|
83
|
+
g = int(hex_value[2:4], 16)
|
|
84
|
+
b = int(hex_value[4:6], 16)
|
|
85
|
+
a = int(hex_value[6:8], 16)
|
|
86
|
+
else:
|
|
87
|
+
raise ValueError("bad hex bruh")
|
|
88
|
+
return r, g, b, a
|
|
89
|
+
|
|
90
|
+
# return pygame-friendly color tuple
|
|
91
|
+
def to_tuple(self):
|
|
92
|
+
return (self.r, self.g, self.b, self.a)
|
|
93
|
+
|
|
94
|
+
# rgba -> hex
|
|
95
|
+
def to_hex(self):
|
|
96
|
+
return "#{:02X}{:02X}{:02X}{:02X}".format(self.r, self.g, self.b, self.a)
|
|
97
|
+
|
|
98
|
+
# quick alpha edit
|
|
99
|
+
def set_alpha(self, a):
|
|
100
|
+
self.a = max(0, min(255, a))
|
|
101
|
+
return self
|
|
102
|
+
|
|
103
|
+
# color math
|
|
104
|
+
def brighten(self, amt=30):
|
|
105
|
+
self.r = min(255, self.r + amt)
|
|
106
|
+
self.g = min(255, self.g + amt)
|
|
107
|
+
self.b = min(255, self.b + amt)
|
|
108
|
+
return self
|
|
109
|
+
|
|
110
|
+
def darken(self, amt=30):
|
|
111
|
+
self.r = max(0, self.r - amt)
|
|
112
|
+
self.g = max(0, self.g - amt)
|
|
113
|
+
self.b = max(0, self.b - amt)
|
|
114
|
+
return self
|
|
115
|
+
|
|
116
|
+
@staticmethod
|
|
117
|
+
def lerp(c1, c2, t: float):
|
|
118
|
+
"""blend between two colors"""
|
|
119
|
+
r = c1.r + (c2.r - c1.r) * t
|
|
120
|
+
g = c1.g + (c2.g - c1.g) * t
|
|
121
|
+
b = c1.b + (c2.b - c1.b) * t
|
|
122
|
+
a = c1.a + (c2.a - c1.a) * t
|
|
123
|
+
return Color(int(r), int(g), int(b), int(a))
|
|
@@ -9,10 +9,6 @@ def hex_to_rgb(hex_str):
|
|
|
9
9
|
hex_str = hex_str.lstrip("#")
|
|
10
10
|
return tuple(int(hex_str[i:i+2], 16) for i in (0, 2, 4))
|
|
11
11
|
|
|
12
|
-
def random_color():
|
|
13
|
-
"""Return a random RGB color"""
|
|
14
|
-
return (random.randint(0,255), random.randint(0,255), random.randint(0,255))
|
|
15
|
-
|
|
16
12
|
def lerp_color(c1, c2, t):
|
|
17
13
|
"""Linearly interpolate between two colors"""
|
|
18
14
|
return tuple(int(a + (b-a)*t) for a,b in zip(c1,c2))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crystalwindow
|
|
3
|
-
Version: 3.8.
|
|
3
|
+
Version: 3.8.5
|
|
4
4
|
Summary: A Tkinter powered window + GUI toolkit made by Crystal (MEEEEEE)! Easier apps, smoother UI and all-in-one helpers!
|
|
5
5
|
Home-page: https://pypi.org/project/crystalwindow/
|
|
6
6
|
Author: CrystalBallyHereXD
|
|
@@ -7,7 +7,7 @@ with open("README.md", encoding="utf-8") as f:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="crystalwindow",
|
|
10
|
-
version="3.8.
|
|
10
|
+
version="3.8.5", # Force metadata refresh
|
|
11
11
|
packages=find_packages(include=["crystalwindow", "crystalwindow.*"]),
|
|
12
12
|
|
|
13
13
|
include_package_data=True, # include package_data files
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|