crystalwindow 5.7__py3-none-any.whl → 5.9__py3-none-any.whl

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/__init__.py CHANGED
@@ -21,7 +21,7 @@ from .assets import (
21
21
  flip_horizontal,
22
22
  flip_vertical,
23
23
  LoopAnim,
24
- loop_image,
24
+ loop_images,
25
25
  load_file,
26
26
  Sound,
27
27
  )
@@ -84,7 +84,7 @@ __all__ = [
84
84
  "flip_vertical",
85
85
  "Animation",
86
86
  "LoopAnim",
87
- "loop_image",
87
+ "loop_images",
88
88
  "load_file",
89
89
  "Sound",
90
90
 
crystalwindow/assets.py CHANGED
@@ -176,7 +176,7 @@ class LoopAnim:
176
176
  return self.frames[int(self.i)]
177
177
 
178
178
 
179
- def loop_image(*imgs, speed=0.2):
179
+ def loop_images(*imgs, speed=0.2):
180
180
  """
181
181
  Usage:
182
182
  anim = loop_image(img1, img2, img3)
crystalwindow/sprites.py CHANGED
@@ -72,6 +72,10 @@ class Sprite:
72
72
  """Create sprite using a simple rectangle"""
73
73
  return cls(pos, size=(w, h), color=color)
74
74
 
75
+ @classmethod
76
+ def group(cls, *sprites):
77
+ """Create a list of sprites"""
78
+ return list(sprites)
75
79
 
76
80
  # === MOVE / DRAW ===
77
81
  def draw(self, win, cam=None):
crystalwindow/window.py CHANGED
@@ -218,6 +218,14 @@ class Window:
218
218
 
219
219
  return False
220
220
 
221
+ def keys_combined(self, *keys):
222
+ for key in keys:
223
+ if isinstance(key, str):
224
+ key = self.KEY_MAP.get(key, key)
225
+ if not self.keys.get(key, False):
226
+ return False
227
+ return True
228
+
221
229
  def key_held(self, key):
222
230
  if isinstance(key, str):
223
231
  key = self.KEY_MAP.get(key, key)
@@ -533,6 +541,14 @@ class Window:
533
541
  bold = kwargs.pop("bold", False)
534
542
  italic = kwargs.pop("italic", False)
535
543
 
544
+ pil_font = None
545
+
546
+ if hasattr(font, "font"):
547
+ pil_font = font.font
548
+ font_name = font.font_name
549
+ else:
550
+ font_name = font
551
+
536
552
  # scale
537
553
  scaled_size = size
538
554
 
@@ -549,9 +565,9 @@ class Window:
549
565
 
550
566
  # tkinter font tuple
551
567
  if style:
552
- font_tuple = (font, scaled_size, style)
568
+ font_tuple = (font_name, scaled_size, style)
553
569
  else:
554
- font_tuple = (font, scaled_size)
570
+ font_tuple = (font_name, scaled_size)
555
571
 
556
572
  # ---------------- NORMAL COLOR TEXT ----------------
557
573
  if mode != "texture":
@@ -579,10 +595,19 @@ class Window:
579
595
  from PIL import Image, ImageDraw, ImageFont, ImageTk
580
596
 
581
597
  # try load font with style
582
- try:
583
- fnt = ImageFont.truetype(font + ".ttf", scaled_size)
584
- except:
585
- fnt = ImageFont.load_default()
598
+ # choose correct PIL font
599
+ if pil_font and hasattr(font, "font_path") and font.font_path:
600
+ try:
601
+ fnt = ImageFont.truetype(font.font_path, scaled_size)
602
+ except:
603
+ fnt = ImageFont.load_default()
604
+ elif pil_font:
605
+ fnt = pil_font
606
+ else:
607
+ try:
608
+ fnt = ImageFont.truetype(font_name + ".ttf", scaled_size)
609
+ except:
610
+ fnt = ImageFont.load_default()
586
611
 
587
612
  # measure text
588
613
  temp = Image.new("L", (1, 1), 0)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crystalwindow
3
- Version: 5.7
3
+ Version: 5.9
4
4
  Summary: A Tkinter powered window + GUI toolkit made by Crystal (ME)! Easier apps, smoother UI and all-in-one helpers!, Gui, Buttons, FileHelper, Sprites, Animations, Colors, Math, Gravity, Camera, 3D and more!
5
5
  Home-page: https://pypi.org/project/crystalwindow/
6
6
  Author: CrystalBallyHereXD
@@ -1,11 +1,11 @@
1
1
  crystalwindow/FileHelper.py,sha256=U20iwND4jX1y91TOK46e8MPH8xyw7GOrZ697nPEnOPk,10706
2
2
  crystalwindow/Fonts.py,sha256=XGqmM3GaauM5a74BtqhKk9zzKgQPcHyN3vcOP1TeoOs,954
3
3
  crystalwindow/System.py,sha256=-ecjzVlTH4ncNnZ_SDNfvqoQLeh8Zefy9laojpQKUUk,4045
4
- crystalwindow/__init__.py,sha256=TPZxsnfmii8ju57zd6tbmuVkiY4v5FVAriZ-CPQHW6Q,3351
4
+ crystalwindow/__init__.py,sha256=whd-PzhvfO-6ALR7OpaomH0PDhfVjTP90I35DmoeYTk,3353
5
5
  crystalwindow/ai.py,sha256=YIt6dNe1QljSAlNECCVa3DMUSIqQEJRIAAbQpYqFNNo,11525
6
6
  crystalwindow/animation.py,sha256=zHjrdBXQeyNaLAuaGPldJueX05OZ5j31YR8NizmR0uQ,427
7
7
  crystalwindow/apphelper.py,sha256=CAcX5n0Jq7zdBMFZkwbMt3_M0mBVVZRoXldOcXsZan4,2924
8
- crystalwindow/assets.py,sha256=8MxPSk7W5YcBnKDh6KcLdg34uxmACf_m6feSYFCWHqA,11405
8
+ crystalwindow/assets.py,sha256=qboSNaWY3fWfnQWRZCkVzpAn1aZYmSgQWVxaE2CNXGY,11406
9
9
  crystalwindow/camera.py,sha256=fe0DXIcZ-TSVPPHxRptFufadnkhysWRZDTJxjxf6SEo,1606
10
10
  crystalwindow/chatvpn.py,sha256=Ij3wRNrMbPINO-SX9vx8xlrKRLvG7zJgzAN2T0jzSz8,2477
11
11
  crystalwindow/clock.py,sha256=M7oMjnGNkFOcchqtQn_voWao4kFtxXpTJe2VUjqvGKQ,5041
@@ -24,15 +24,13 @@ crystalwindow/math.py,sha256=AGhLGkPWozNOMlSieF5u8jSDY0qakOPJIi5aWI9P91o,1598
24
24
  crystalwindow/messagebus.py,sha256=9K2P_TkdQ1rt-oouIkRg_XHwMTwykttBt-9gFYaItyI,696
25
25
  crystalwindow/objects.py,sha256=BWqjlxOXpaCGeaAocFL5L9Qh-a_MRjbN6Qb-Vd7R0K8,6262
26
26
  crystalwindow/scores.py,sha256=O5E-rceNEaRpsC3XZ2PpE5gsLvJk86f4ChA5UNdd4b0,1069
27
- crystalwindow/sprites.py,sha256=IADCQetFDQoat3qGpKkH93TdtqqgldfHl4N0HKX1Ajc,7480
27
+ crystalwindow/sprites.py,sha256=REkKkKi1oDQBjnjM7fX-49_zsJmTlwpDpoX8PlTohtQ,7599
28
28
  crystalwindow/tilemap.py,sha256=endJ8KcbP9EjPvL9qWsOpV4jc_Re1yH080aUyDkwufA,3378
29
29
  crystalwindow/ver_warner.py,sha256=qEN3ulc1NixBy15FFx2R3Zu0DhyJTVJwiESGAPwpynM,3373
30
30
  crystalwindow/websearch.py,sha256=IgsoKt27yCBHeq8yFVfSq_8sEj5KP6mqn2yNRTsRw1A,5161
31
- crystalwindow/window.py,sha256=i9VRJyVVMQoLzaHbOuZHsdmtmwXRA9h-pL_Tc8Kb5XY,32327
31
+ crystalwindow/window.py,sha256=yo_Onk0RYEjUMhzKsNXJDBlYYFF9l9Nhbxiza3wf4UY,33128
32
32
  crystalwindow/Icons/default_icon.png,sha256=Loq27Pxb8Wb3Sz-XwtNF1RmlLNxR4TcfOWfK-1lWcII,7724
33
33
  crystalwindow/Icons/file_icons.png,sha256=kqjvz3gMaIbepW4XGrLZOjDYu-yhFbVxjvylS-0RO4U,5659
34
- crystalwindow/docs/getting_started.md,sha256=e_XEhJk8eatS22MX0nRX7hQNkYkwN9both1ObabZSTw,5759
35
- crystalwindow/docs/index.md,sha256=bd14uLWtRSeRBm28zngGyfGDI1J6bJRvHkQLDpYwgOE,747
36
34
  crystalwindow/gametests/3dsquare.py,sha256=MM_RRx1mz_NeBhTAoNomzn_IAbbN4ZnQZWA9VAFL8mY,821
37
35
  crystalwindow/gametests/__init__.py,sha256=TRwhDl8aO3Wdqu_DXi9qT35CqF86AIyLqOSAkjNMJFY,240
38
36
  crystalwindow/gametests/__main__.py,sha256=93R7DXHRK7GPsMrZB526pkWCrKJ728E1G4wCbHk3kP0,751
@@ -42,8 +40,8 @@ crystalwindow/gametests/sandbox.py,sha256=Oo2tU2N0y3BPVa6T5vs_h9N6islhQrjSrr_78X
42
40
  crystalwindow/gametests/squaremove.py,sha256=ei6DMnvcgpOhmxbGv-Yqmx5EqiZjKbVlZhI7YbT2hY8,643
43
41
  crystalwindow/gametests/testtttagain.py,sha256=oIhK9MGgMVly_W2lRwD9Hn9WyPdd8JnX2HGrLTGZdxY,373
44
42
  crystalwindow/gametests/windowtesting.py,sha256=_9X6wnV1-_X_PtNS-0zu-k209NtFIwAc4vpxLPp7V2o,97
45
- crystalwindow-5.7.dist-info/licenses/LICENSE,sha256=Gt5cJRchdNt0guxyQMHKsATN5PM5mjuDhdO6Gzs9qQc,1096
46
- crystalwindow-5.7.dist-info/METADATA,sha256=h51DQWqw7tkDiMHrMGks1wq2CIvVL1RKT_YxNMI8C4I,7523
47
- crystalwindow-5.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
48
- crystalwindow-5.7.dist-info/top_level.txt,sha256=PeQSld4b19XWT-zvbYkvE2Xg8sakIMbDzSzSdOSRN8o,14
49
- crystalwindow-5.7.dist-info/RECORD,,
43
+ crystalwindow-5.9.dist-info/licenses/LICENSE,sha256=Gt5cJRchdNt0guxyQMHKsATN5PM5mjuDhdO6Gzs9qQc,1096
44
+ crystalwindow-5.9.dist-info/METADATA,sha256=3E8i92v7k5r5ZEalfSSeYpE61uTcKeYsitj3-Q94SI4,7523
45
+ crystalwindow-5.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
46
+ crystalwindow-5.9.dist-info/top_level.txt,sha256=PeQSld4b19XWT-zvbYkvE2Xg8sakIMbDzSzSdOSRN8o,14
47
+ crystalwindow-5.9.dist-info/RECORD,,
@@ -1,209 +0,0 @@
1
- # CRYSTALWINDOW!!!
2
-
3
- A tiny but mighty Tkinter framework that gives u a full window system, GUI magic, physics, and file power — all packed into one clean lil module. Made by Crystal.
4
-
5
- No setup pain. No folder chaos.
6
- Just import it. Boom. Instant game window. 🎮
7
-
8
- # Quick Start
9
- pip install crystalwindow
10
-
11
- Then make a new .py file:
12
-
13
- from crystalwindow import Window # imports everything from crystalwindow (in this case its Window)
14
-
15
- win = Window(800, 600, "Crystal Demo") # setup: Window(width, height, name, icon=MyIcon.ico)
16
- win.run() # runs the window loop
17
- win.quit() # closes it (for RAM n CPU)
18
-
19
- Run it. And boom, instant working window.
20
- Yes, THAT easy.
21
-
22
- # Easy CrystalWindow Window + GUI + Text File:
23
- from crystalwindow import *
24
-
25
- win = Window(800, 600, "CrystalWindowLib Mega Sandbox")
26
-
27
- gui = GUIManager()
28
- toggle1 = Toggle((50, 50, 100, 40), value=False)
29
- slider1 = Slider((50, 120, 200, 30), min_val=0, max_val=100, value=50)
30
-
31
- btn1 = Button(rect=(50, 200, 150, 50), text="Click Me!", color=random_color(),
32
- hover_color=random_color(), callback=lambda: print("Button clicked!"))
33
- lbl1 = Label((250, 50), "Hello GUI!", color=random_color(), size=24)
34
-
35
- gui.add(toggle1)
36
- gui.add(slider1)
37
- gui.add(btn1)
38
- gui.add(lbl1)
39
-
40
- # --- Debug Overlay ---
41
- debug = DebugOverlay()
42
-
43
- # --- Camera Shake ---
44
- shake = CameraShake(intensity=20)
45
-
46
- # --- Main Loop ---
47
- def update(win):
48
- gui.update(win)
49
- gui.draw(win)
50
-
51
- # --- draw text examples ---
52
- win.draw_text_later("Normal Text", pos=(400, 50), size=18, color=random_color())
53
- win.draw_text_later("Bold Text", pos=(400, 80), size=20, color=random_color(), bold=True)
54
- win.draw_text_later("Italic Text", pos=(400, 110), size=20, color=random_color(), italic=True)
55
- win.draw_text_later("Bold + Italic", pos=(400, 140), size=22, color=random_color(), bold=True, italic=True)
56
-
57
- # --- draw toggle/slider values ---
58
- win.draw_text_later(f"Toggle: {toggle1.value}", pos=(50, 90), size=18)
59
- win.draw_text_later(f"Slider: {int(slider1.value)}", pos=(50, 160), size=18)
60
-
61
- # --- draw gradient ---
62
- gradient_rect(win, (50, 300, 200, 100), (255,0,0), (0,0,255))
63
-
64
- # --- screen shake example ---
65
- shake.update()
66
- x_off, y_off = shake.offset
67
- win.draw_rect((0,255,0), (500+x_off, 300+y_off, 100, 50))
68
-
69
- # --- draw random name + color ---
70
- win.draw_text_later(f"Random Name: {random_name()}", pos=(50, 420), size=20, color=random_color())
71
-
72
- # --- debug overlay ---
73
- debug.draw(win, fps=int(win.clock.get_fps()))
74
-
75
- win.run(update)
76
- win.quit()
77
-
78
- And now thats how you use it!
79
-
80
- # Whats Inside
81
-
82
- Built-in window manager
83
- Built-in GUI (buttons, sliders, toggles, labels)
84
- Built-in gravity + physics engine
85
- TileMap system (place & save blocks!)
86
- Image loader (with default base64 logo)
87
- Safe startup (works inside PyInstaller)
88
- Mathematics Handler
89
- Works offline
90
- Minimal syntax
91
- Full debug overlay
92
-
93
- # Window System
94
- from crystalwindow import *
95
-
96
- win = Window(800, 600, "My Game", icon="MyIcon.png")
97
-
98
- def loop(win):
99
- win.fill((10, 10, 30))
100
- # draw or update stuff here
101
-
102
- win.run(loop)
103
- win.quit()
104
-
105
- # Features
106
- * handles events
107
- * tracks keys + mouse
108
- * supports fullscreen
109
- * safe to close anytime
110
-
111
- # Player Example
112
- player = Player(100, 100)
113
-
114
- def loop(win):
115
- player.update(win.keys)
116
- player.draw(win.screen)
117
-
118
- move(dx, dy) -> moves player
119
- take_damage(x) -> takes damage
120
- heal(x) -> heals
121
- draw(surface) -> renders sprite
122
-
123
- # TileMap
124
- tilemap = TileMap(32)
125
- tilemap.add_tile(5, 5, "grass")
126
- tilemap.save("level.json")
127
-
128
- add_tile(x, y, type)
129
- remove_tile(x, y)
130
- draw(surface)
131
- save(file) / load(file)
132
-
133
- # GUI System
134
- btn = Button(20, 20, 120, 40, "Click Me!", lambda: print("yo"))
135
- gui = GUIManager()
136
- gui.add(btn)
137
-
138
- Use built-in stuff like:
139
- Button(x, y, w, h, text, onclick)
140
- Label(x, y, text)
141
- Toggle(x, y, w, h, text, default=False)
142
- Slider(x, y, w, min, max, default)
143
-
144
- # Gravity
145
- g = Gravity(0.5)
146
- g.update(player)
147
-
148
- # FileHelper
149
- save_json("data.json", {"coins": 99})
150
- data = load_json("data.json")
151
-
152
- Also supports:
153
- save_pickle / load_pickle
154
- FileDialog("save") # tkinter popup
155
-
156
- # DrawHelper
157
- DrawHelper.text(win.screen, "Hello!", (10,10), (255,255,255), 24)
158
- DrawHelper.rect(win.screen, (100,0,200), (50,50,100,60))
159
-
160
- # Debug Tools
161
- debug = DebugOverlay()
162
- debug.toggle() # show/hide FPS
163
- debug.draw(win.screen, {"hp": 100, "fps": win.clock.get_fps()})
164
-
165
- # Mathematics
166
- math = Mathematics()
167
- math.add(num1, num2)
168
- math.subtract(num1, num2)
169
- math.multiply(num1, num2)
170
- math.divide(num1, num2)
171
-
172
- # Example Game
173
- from crystalwindow import *
174
-
175
- win = Window(800, 600, "My Cool Game")
176
- player = Player(100, 100)
177
- gravity = Gravity()
178
-
179
- def update(win):
180
- win.fill((25, 25, 40))
181
- player.update(win.keys)
182
- gravity.update(player)
183
- player.draw(win.screen)
184
-
185
- win.run(update)
186
- win.quit()
187
-
188
- # Default Logo
189
- There is a lil encoded PNG inside the file called DEFAULT_LOGO_BASE64.
190
- Its used when no icon is given. Set ur own like:
191
-
192
- Window(800, 600, "My Window", icon="MyIcon.png")
193
-
194
- # Example Integration
195
- from crystalwindow import Window
196
-
197
- win = Window(800, 600, "My Window", icon="MyIcon.png")
198
-
199
- while win.running:
200
- win.check_events()
201
- win.fill((10, 10, 20))
202
- win.run()
203
- win.quit()
204
-
205
- # Credits
206
- Made by: CrystalBallyHereXD
207
- Framework: CrystalWindow
208
- Powered by: Tkinter and Python
209
- License: Free to use, modify, and vibe with it!
@@ -1,27 +0,0 @@
1
- CrystalWindow Documentation
2
-
3
- Welcome to CrystalWindow, the all-in-one Python toolkit for making games, mini apps, GUI tools, and mods! 🧊✨
4
-
5
- Version: 3.6
6
- Author: CrystalBallyHereXD
7
- License: MIT
8
-
9
- # Overview
10
-
11
- * CrystalWindow makes game dev and Python GUI work super easy. It includes:
12
-
13
- * Window management – create resizable, full-featured windows.
14
-
15
- * Sprites – images, movement, collisions.
16
-
17
- * TileMap – build levels with tiles like grass, dirt, walls.
18
-
19
- * GUI – Buttons, Labels, Toggles, Sliders.
20
-
21
- * Gravity & Physics – simple but extendable.
22
-
23
- * Debug tools – hitboxes, overlays, testing utilities.
24
-
25
- * File saving/loading – JSON, pickle, text.
26
-
27
- * Modding support – extend, override, or add new features.