crystalwindow 3.6.7__py3-none-any.whl → 3.6.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/window.py +13 -2
- {crystalwindow-3.6.7.dist-info → crystalwindow-3.6.9.dist-info}/METADATA +1 -1
- {crystalwindow-3.6.7.dist-info → crystalwindow-3.6.9.dist-info}/RECORD +6 -6
- {crystalwindow-3.6.7.dist-info → crystalwindow-3.6.9.dist-info}/WHEEL +0 -0
- {crystalwindow-3.6.7.dist-info → crystalwindow-3.6.9.dist-info}/licenses/LICENSE +0 -0
- {crystalwindow-3.6.7.dist-info → crystalwindow-3.6.9.dist-info}/top_level.txt +0 -0
crystalwindow/window.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# === Window Management (tkinter version) ===
|
|
2
2
|
import tkinter as tk
|
|
3
|
-
import base64, io, os, sys, contextlib
|
|
3
|
+
import base64, io, os, sys, contextlib, time
|
|
4
4
|
|
|
5
5
|
# === Boot ===
|
|
6
6
|
main_file = os.path.basename(sys.argv[0])
|
|
@@ -114,6 +114,8 @@ class Window:
|
|
|
114
114
|
self._mouse_pressed = (False, False, False)
|
|
115
115
|
self._bg_color = (20, 20, 50)
|
|
116
116
|
self.draw_calls = []
|
|
117
|
+
self._key_last = {} # new dict to store last press time per key
|
|
118
|
+
self._key_cooldown = 0.15 # seconds, tweak for faster/slower input
|
|
117
119
|
|
|
118
120
|
# === Event bindings ===
|
|
119
121
|
self.root.bind("<KeyPress>", self._on_keydown)
|
|
@@ -148,7 +150,16 @@ class Window:
|
|
|
148
150
|
def key_pressed(self, key):
|
|
149
151
|
if isinstance(key, str):
|
|
150
152
|
key = self.KEY_MAP.get(key, key)
|
|
151
|
-
|
|
153
|
+
|
|
154
|
+
now = time.time()
|
|
155
|
+
pressed = self.keys.get(key, False)
|
|
156
|
+
|
|
157
|
+
last = self._key_last.get(key, 0)
|
|
158
|
+
if pressed and (now - last) >= self._key_cooldown:
|
|
159
|
+
self._key_last[key] = now
|
|
160
|
+
return True
|
|
161
|
+
|
|
162
|
+
return False
|
|
152
163
|
|
|
153
164
|
def mouse_pressed(self, button=1):
|
|
154
165
|
return self._mouse_pressed[button - 1]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crystalwindow
|
|
3
|
-
Version: 3.6.
|
|
3
|
+
Version: 3.6.9
|
|
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
|
|
@@ -19,7 +19,7 @@ crystalwindow/player.py,sha256=4wpIdUZLTlRXV8fDRQ11yVJRbx_cv8Ekpn2y7pQGgAQ,3442
|
|
|
19
19
|
crystalwindow/sprites.py,sha256=YVoLnpLsCHlHmTahk8hwWnUtkcI-FC_w4OjZN4YtmLs,2569
|
|
20
20
|
crystalwindow/tilemap.py,sha256=PHoKL1eWuNeHIf0w-Jh5MGdQGEgklVsxqqJOS-GNMKI,322
|
|
21
21
|
crystalwindow/ver_warner.py,sha256=qEN3ulc1NixBy15FFx2R3Zu0DhyJTVJwiESGAPwpynM,3373
|
|
22
|
-
crystalwindow/window.py,sha256=
|
|
22
|
+
crystalwindow/window.py,sha256=07YzeF-XHNBbQu2USscAvfE3_V-dmkjxzibnvKJFcVQ,18169
|
|
23
23
|
crystalwindow/Icons/default_icon.png,sha256=Loq27Pxb8Wb3Sz-XwtNF1RmlLNxR4TcfOWfK-1lWcII,7724
|
|
24
24
|
crystalwindow/docs/getting_started.md,sha256=e_XEhJk8eatS22MX0nRX7hQNkYkwN9both1ObabZSTw,5759
|
|
25
25
|
crystalwindow/docs/index.md,sha256=bd14uLWtRSeRBm28zngGyfGDI1J6bJRvHkQLDpYwgOE,747
|
|
@@ -31,8 +31,8 @@ crystalwindow/gametests/guitesting.py,sha256=SrOssY5peCQEV6TQ1AiOWtjb9phVGdRzW-Q
|
|
|
31
31
|
crystalwindow/gametests/sandbox.py,sha256=Oo2tU2N0y3BPVa6T5vs_h9N6islhQrjSrr_78XLut5I,1007
|
|
32
32
|
crystalwindow/gametests/squaremove.py,sha256=poP2Zjl2oc2HVvIAgIK34H2jVj6otL4jEdvAOR6L9sI,572
|
|
33
33
|
crystalwindow/gametests/windowtesting.py,sha256=_9X6wnV1-_X_PtNS-0zu-k209NtFIwAc4vpxLPp7V2o,97
|
|
34
|
-
crystalwindow-3.6.
|
|
35
|
-
crystalwindow-3.6.
|
|
36
|
-
crystalwindow-3.6.
|
|
37
|
-
crystalwindow-3.6.
|
|
38
|
-
crystalwindow-3.6.
|
|
34
|
+
crystalwindow-3.6.9.dist-info/licenses/LICENSE,sha256=7pvUgvRXL3ED5VVAZPH5oGn1CaIXcyoDC9gqox6sB0g,1079
|
|
35
|
+
crystalwindow-3.6.9.dist-info/METADATA,sha256=TslLKDnbCPJgnapM3zXOu70iIYHxZJnq9gezOu_LsQk,7340
|
|
36
|
+
crystalwindow-3.6.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
37
|
+
crystalwindow-3.6.9.dist-info/top_level.txt,sha256=PeQSld4b19XWT-zvbYkvE2Xg8sakIMbDzSzSdOSRN8o,14
|
|
38
|
+
crystalwindow-3.6.9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|