crystalwindow 4.8__tar.gz → 4.9__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 (51) hide show
  1. {crystalwindow-4.8/crystalwindow.egg-info → crystalwindow-4.9}/PKG-INFO +1 -1
  2. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/__init__.py +10 -0
  3. crystalwindow-4.9/crystalwindow/chatvpn.py +82 -0
  4. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/clock.py +11 -0
  5. crystalwindow-4.9/crystalwindow/messagebus.py +33 -0
  6. {crystalwindow-4.8 → crystalwindow-4.9/crystalwindow.egg-info}/PKG-INFO +1 -1
  7. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow.egg-info/SOURCES.txt +2 -0
  8. {crystalwindow-4.8 → crystalwindow-4.9}/setup.py +1 -1
  9. {crystalwindow-4.8 → crystalwindow-4.9}/LICENSE +0 -0
  10. {crystalwindow-4.8 → crystalwindow-4.9}/MANIFEST.in +0 -0
  11. {crystalwindow-4.8 → crystalwindow-4.9}/README.md +0 -0
  12. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/FileHelper.py +0 -0
  13. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/Icons/default_icon.png +0 -0
  14. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/Icons/file_icons.png +0 -0
  15. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/ai.py +0 -0
  16. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/animation.py +0 -0
  17. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/assets.py +0 -0
  18. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/camera.py +0 -0
  19. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/collision.py +0 -0
  20. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/color_handler.py +0 -0
  21. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/crystal3d.py +0 -0
  22. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/docs/getting_started.md +0 -0
  23. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/docs/index.md +0 -0
  24. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/draw_helpers.py +0 -0
  25. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/draw_rects.py +0 -0
  26. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/draw_text_helper.py +0 -0
  27. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/draw_tool.py +0 -0
  28. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/fun_helpers.py +0 -0
  29. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/gametests/3dsquare.py +0 -0
  30. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/gametests/__init__.py +0 -0
  31. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/gametests/__main__.py +0 -0
  32. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/gametests/gravitytest.py +0 -0
  33. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/gametests/guitesting.py +0 -0
  34. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/gametests/sandbox.py +0 -0
  35. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/gametests/squaremove.py +0 -0
  36. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/gametests/testtttagain.py +0 -0
  37. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/gametests/windowtesting.py +0 -0
  38. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/gravity.py +0 -0
  39. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/gui.py +0 -0
  40. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/gui_ext.py +0 -0
  41. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/math.py +0 -0
  42. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/objects.py +0 -0
  43. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/sprites.py +0 -0
  44. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/tilemap.py +0 -0
  45. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/ver_warner.py +0 -0
  46. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/websearch.py +0 -0
  47. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow/window.py +0 -0
  48. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow.egg-info/dependency_links.txt +0 -0
  49. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow.egg-info/requires.txt +0 -0
  50. {crystalwindow-4.8 → crystalwindow-4.9}/crystalwindow.egg-info/top_level.txt +0 -0
  51. {crystalwindow-4.8 → crystalwindow-4.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crystalwindow
3
- Version: 4.8
3
+ Version: 4.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
@@ -52,6 +52,11 @@ from .websearch import SearchResult, WebBrowse
52
52
  # === 3D Engine ===
53
53
  from .crystal3d import CW3DShape, CW3D
54
54
 
55
+ # === Chatting/VPN Engine =====
56
+ from .chatvpn import ChatVPN, ChatVPNServer
57
+
58
+ # ==== Message Bus ====
59
+ from .messagebus import send_message, view_message, clear_messages
55
60
 
56
61
  __all__ = [
57
62
  # --- Core ---
@@ -93,4 +98,9 @@ __all__ = [
93
98
  # --- 3D ---
94
99
  "CW3DShape", "CW3D",
95
100
 
101
+ # --- ChatVPN ---
102
+ "ChatVPN", "ChatVPNServer",
103
+
104
+ # --- Message Bus ---
105
+ "send_message", "view_message", "clear_messages",
96
106
  ]
@@ -0,0 +1,82 @@
1
+ import socket
2
+ import threading
3
+ import json
4
+
5
+
6
+ # ====================================================
7
+ # ChatVPN SERVER (built into this file)
8
+ # ====================================================
9
+ class ChatVPNServer:
10
+ def __init__(self, host="0.0.0.0", port=9001):
11
+ self.host = host
12
+ self.port = port
13
+ self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
14
+ self.sock.bind((self.host, self.port))
15
+ self.clients = set()
16
+ self.running = False
17
+
18
+ def start(self):
19
+ if self.running:
20
+ return
21
+ self.running = True
22
+ print(f"[ChatVPN-Server] running on {self.host}:{self.port}")
23
+ threading.Thread(target=self._loop, daemon=True).start()
24
+
25
+ def _loop(self):
26
+ while self.running:
27
+ data, addr = self.sock.recvfrom(4096)
28
+
29
+ if addr not in self.clients:
30
+ self.clients.add(addr)
31
+ print(f"[ChatVPN-Server] new client: {addr}")
32
+
33
+ for c in self.clients:
34
+ if c != addr:
35
+ self.sock.sendto(data, c)
36
+
37
+ def stop(self):
38
+ self.running = False
39
+ self.sock.close()
40
+ print("[ChatVPN-Server] stopped.")
41
+
42
+
43
+ # ====================================================
44
+ # ChatVPN CLIENT
45
+ # ====================================================
46
+ class ChatVPN:
47
+ def __init__(self, server_ip: str, port: int = 9001):
48
+ self.server = (server_ip, port)
49
+ self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
50
+ self.running = False
51
+ self._on_msg = None
52
+
53
+ def start(self):
54
+ if self.running:
55
+ return
56
+ self.running = True
57
+ threading.Thread(target=self._recv_loop, daemon=True).start()
58
+ print(f"[ChatVPN-Client] connected to {self.server}")
59
+
60
+ def send(self, text: str):
61
+ packet = json.dumps({"type": "text", "data": text}).encode()
62
+ self.sock.sendto(packet, self.server)
63
+
64
+ def on_msg(self, func):
65
+ self._on_msg = func
66
+
67
+ def _recv_loop(self):
68
+ while self.running:
69
+ try:
70
+ data, _ = self.sock.recvfrom(4096)
71
+ except OSError:
72
+ break
73
+
74
+ try:
75
+ obj = json.loads(data.decode())
76
+ msg = obj.get("data", "")
77
+ except:
78
+ msg = data.decode()
79
+
80
+ if self._on_msg:
81
+ self._on_msg(msg)
82
+
@@ -45,6 +45,7 @@ class Clock:
45
45
 
46
46
  # FPS
47
47
  self.target_fps = target_fps
48
+ self.timer = CountdownTimer()
48
49
  self.min_frame_time = 1 / target_fps if target_fps else 0
49
50
  self.frame_times = deque(maxlen=smooth_fps)
50
51
 
@@ -145,3 +146,13 @@ class Clock:
145
146
  def timestamp(self):
146
147
  """High-precision monotonic timestamp."""
147
148
  return time.perf_counter()
149
+
150
+ #TIMER
151
+ def start_timer(self, seconds: float):
152
+ self.timer.start(seconds)
153
+
154
+ def timer_ended(self):
155
+ return self.timer.is_finished()
156
+
157
+ def timer_remaining(self):
158
+ return self.timer.get_remaining()
@@ -0,0 +1,33 @@
1
+ # crystalwindow/messagebus.py
2
+
3
+ class MessageBus:
4
+ def __init__(self):
5
+ self._queue = []
6
+
7
+ def send(self, name: str, data=None):
8
+ self._queue.append({
9
+ "name": name,
10
+ "data": data
11
+ })
12
+
13
+ def poll(self, name: str):
14
+ for msg in self._queue:
15
+ if msg["name"] == name:
16
+ self._queue.remove(msg)
17
+ return msg["data"]
18
+ return None
19
+
20
+ def clear(self):
21
+ self._queue.clear()
22
+
23
+
24
+ _bus = MessageBus()
25
+
26
+ def send_message(name: str, data=None):
27
+ _bus.send(name, data)
28
+
29
+ def view_message(name: str):
30
+ return _bus.poll(name)
31
+
32
+ def clear_messages():
33
+ _bus.clear()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: crystalwindow
3
- Version: 4.8
3
+ Version: 4.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
@@ -8,6 +8,7 @@ crystalwindow/ai.py
8
8
  crystalwindow/animation.py
9
9
  crystalwindow/assets.py
10
10
  crystalwindow/camera.py
11
+ crystalwindow/chatvpn.py
11
12
  crystalwindow/clock.py
12
13
  crystalwindow/collision.py
13
14
  crystalwindow/color_handler.py
@@ -21,6 +22,7 @@ crystalwindow/gravity.py
21
22
  crystalwindow/gui.py
22
23
  crystalwindow/gui_ext.py
23
24
  crystalwindow/math.py
25
+ crystalwindow/messagebus.py
24
26
  crystalwindow/objects.py
25
27
  crystalwindow/sprites.py
26
28
  crystalwindow/tilemap.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="4.8", # Force metadata refresh
10
+ version="4.9", # 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