crystalwindow 5.6__tar.gz → 5.8__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.
Files changed (55) hide show
  1. {crystalwindow-5.6/crystalwindow.egg-info → crystalwindow-5.8}/PKG-INFO +1 -1
  2. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/__init__.py +7 -2
  3. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/assets.py +1 -1
  4. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/gametests/gravitytest.py +5 -4
  5. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/objects.py +16 -0
  6. crystalwindow-5.8/crystalwindow/scores.py +35 -0
  7. {crystalwindow-5.6 → crystalwindow-5.8/crystalwindow.egg-info}/PKG-INFO +1 -1
  8. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow.egg-info/SOURCES.txt +1 -2
  9. {crystalwindow-5.6 → crystalwindow-5.8}/setup.py +1 -1
  10. crystalwindow-5.6/crystalwindow/docs/getting_started.md +0 -209
  11. crystalwindow-5.6/crystalwindow/docs/index.md +0 -27
  12. {crystalwindow-5.6 → crystalwindow-5.8}/LICENSE +0 -0
  13. {crystalwindow-5.6 → crystalwindow-5.8}/MANIFEST.in +0 -0
  14. {crystalwindow-5.6 → crystalwindow-5.8}/README.md +0 -0
  15. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/FileHelper.py +0 -0
  16. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/Fonts.py +0 -0
  17. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/Icons/default_icon.png +0 -0
  18. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/Icons/file_icons.png +0 -0
  19. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/System.py +0 -0
  20. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/ai.py +0 -0
  21. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/animation.py +0 -0
  22. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/apphelper.py +0 -0
  23. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/camera.py +0 -0
  24. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/chatvpn.py +0 -0
  25. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/clock.py +0 -0
  26. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/collision.py +0 -0
  27. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/color_handler.py +0 -0
  28. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/crystal3d.py +0 -0
  29. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/draw_helpers.py +0 -0
  30. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/draw_rects.py +0 -0
  31. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/draw_text_helper.py +0 -0
  32. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/draw_tool.py +0 -0
  33. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/fun_helpers.py +0 -0
  34. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/gametests/3dsquare.py +0 -0
  35. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/gametests/__init__.py +0 -0
  36. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/gametests/__main__.py +0 -0
  37. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/gametests/guitesting.py +0 -0
  38. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/gametests/sandbox.py +0 -0
  39. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/gametests/squaremove.py +0 -0
  40. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/gametests/testtttagain.py +0 -0
  41. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/gametests/windowtesting.py +0 -0
  42. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/gravity.py +0 -0
  43. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/gui.py +0 -0
  44. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/gui_ext.py +0 -0
  45. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/math.py +0 -0
  46. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/messagebus.py +0 -0
  47. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/sprites.py +0 -0
  48. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/tilemap.py +0 -0
  49. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/ver_warner.py +0 -0
  50. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/websearch.py +0 -0
  51. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow/window.py +0 -0
  52. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow.egg-info/dependency_links.txt +0 -0
  53. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow.egg-info/requires.txt +0 -0
  54. {crystalwindow-5.6 → crystalwindow-5.8}/crystalwindow.egg-info/top_level.txt +0 -0
  55. {crystalwindow-5.6 → crystalwindow-5.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crystalwindow
3
- Version: 5.6
3
+ Version: 5.8
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
@@ -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
  )
@@ -67,6 +67,8 @@ from .apphelper import GameAppHelper
67
67
  # === System ===
68
68
  from .System import System, Watchdog
69
69
 
70
+ # === Score System ===
71
+ from .scores import Score
70
72
 
71
73
  __all__ = [
72
74
  # --- Core ---
@@ -82,7 +84,7 @@ __all__ = [
82
84
  "flip_vertical",
83
85
  "Animation",
84
86
  "LoopAnim",
85
- "loop_image",
87
+ "loop_images",
86
88
  "load_file",
87
89
  "Sound",
88
90
 
@@ -122,4 +124,7 @@ __all__ = [
122
124
 
123
125
  # --- System ---
124
126
  "System", "Watchdog",
127
+
128
+ # --- Scores ---
129
+ "Score",
125
130
  ]
@@ -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)
@@ -46,11 +46,11 @@ def toggle_fly():
46
46
  fly_button.text = f"Fly: {'ON' if fly_mode else 'OFF'}"
47
47
 
48
48
  # create buttons
49
- fly_button = Button(rect=(35, 60, 180, 40),
49
+ fly_button = Button((35, 60), (180, 40),
50
50
  text="Fly: OFF",
51
51
  color=(150,150,150),
52
52
  hover_color=(200,200,200),
53
- callback=toggle_fly)
53
+ )
54
54
 
55
55
  gui.add(fly_button)
56
56
 
@@ -103,8 +103,9 @@ def update(win):
103
103
 
104
104
  if enemy.collide_with(player):
105
105
  player.hp -= enemy.dmg
106
- if player.dead:
107
- player.respawn(win)
106
+ if player.hp == 0:
107
+ player.redraw(win, new_pos=(0,0))
108
+ player.hp = 100
108
109
 
109
110
  win.draw_text(f"CurrentHP: {player.hp}", font="Arial", size=16, color=(255, 255, 255))
110
111
  # -------------------------------
@@ -177,3 +177,19 @@ class Enemy(Sprite):
177
177
  if self.cooldown <= 0:
178
178
  player.take_damage(self.dmg)
179
179
  self.cooldown = self.cooldown_max
180
+
181
+ # the X and Y is an check like if you want the enemy to chase the player horizontally or vertaically or both like chase_player(player, x=True, y=False) so it chases the player only thru horizontal
182
+ def chase_player(self, obj, mode = "xy"):
183
+ if mode == "x" or mode == "xy":
184
+ if obj.x < self.x:
185
+ self.x -= self.speed
186
+ elif obj.x > self.x:
187
+ self.x += self.speed
188
+
189
+ if mode == "y" or mode == "xy":
190
+ if obj.y < self.y:
191
+ self.y -= self.speed
192
+ elif obj.y > self.y:
193
+ self.y += self.speed
194
+
195
+ self.pos = (self.x, self.y)
@@ -0,0 +1,35 @@
1
+ class Score:
2
+ def __init__(self, name: str, value: int = 0, max_value: int | None = None):
3
+ self.name = name
4
+ self.value = value
5
+ self.max_value = max_value
6
+
7
+ def __str__(self):
8
+ return f"{self.name}: {self.value}"
9
+
10
+
11
+ def score_up(self, amount: int = 1):
12
+ self.value += amount
13
+ if self.max_value is not None:
14
+ self.value = min(self.value, self.max_value)
15
+
16
+ def reset(self):
17
+ self.value = 0
18
+
19
+ def score_down(self, amount: int = 1):
20
+ self.value = max(0, self.value - amount)
21
+
22
+ def set_score(self, value: int):
23
+ self.value = value
24
+ if self.max_value is not None:
25
+ self.value = min(self.value, self.max_value)
26
+ def set_maxv(self, value: int):
27
+ self.max_value = value
28
+ if self.value > self.max_value:
29
+ self.value = self.max_value
30
+
31
+ def get_score(name: str, scores: list[Score]) -> Score | None:
32
+ for score in scores:
33
+ if score.name == name:
34
+ return score
35
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crystalwindow
3
- Version: 5.6
3
+ Version: 5.8
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
@@ -27,6 +27,7 @@ crystalwindow/gui_ext.py
27
27
  crystalwindow/math.py
28
28
  crystalwindow/messagebus.py
29
29
  crystalwindow/objects.py
30
+ crystalwindow/scores.py
30
31
  crystalwindow/sprites.py
31
32
  crystalwindow/tilemap.py
32
33
  crystalwindow/ver_warner.py
@@ -39,8 +40,6 @@ crystalwindow.egg-info/requires.txt
39
40
  crystalwindow.egg-info/top_level.txt
40
41
  crystalwindow/Icons/default_icon.png
41
42
  crystalwindow/Icons/file_icons.png
42
- crystalwindow/docs/getting_started.md
43
- crystalwindow/docs/index.md
44
43
  crystalwindow/gametests/3dsquare.py
45
44
  crystalwindow/gametests/__init__.py
46
45
  crystalwindow/gametests/__main__.py
@@ -7,7 +7,7 @@ with open("README.md", encoding="utf-8") as f:
7
7
 
8
8
  setup(
9
9
  name="crystalwindow",
10
- version="5.6", # Force metadata refresh
10
+ version="5.8", # Force metadata refresh
11
11
  packages=find_packages(include=["crystalwindow", "crystalwindow.*"]),
12
12
 
13
13
  include_package_data=True, # include package_data files
@@ -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.
File without changes
File without changes
File without changes
File without changes