zhmiscellany 5.9.7__py3-none-any.whl → 5.9.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.
zhmiscellany/macro.py CHANGED
@@ -129,12 +129,13 @@ def click_pixel(x=None, y=None, click_duration=None, right_click=False, middle_c
129
129
  if not (animation_time and relative):
130
130
  targ = tuple(a + b for a, b in zip(get_mouse_xy(), (cx, cy)))
131
131
  move_mouse(cx, cy, relative=relative)
132
- for i in range(limit):
133
- cur_pos = get_mouse_xy()
134
- if cur_pos != targ:
135
- move_mouse(max(-1, min(1, (targ[0]-cur_pos[0]))), max(-1, min(1, (targ[1]-cur_pos[1]))), relative=relative)
136
- else:
137
- break
132
+ if ensure_movement:
133
+ for i in range(limit):
134
+ cur_pos = get_mouse_xy()
135
+ if cur_pos != targ:
136
+ move_mouse(max(-1, min(1, (targ[0]-cur_pos[0]))), max(-1, min(1, (targ[1]-cur_pos[1]))), relative=relative)
137
+ else:
138
+ break
138
139
 
139
140
  if pre_click_duration:
140
141
  if pre_click_wiggle:
@@ -258,6 +259,15 @@ def type_string(text=None, delay=None, key_hold_time=None, vk_codes=None, combin
258
259
  press_key(vk_code, False, act_start=False, act_end=True, key_hold_time=key_hold_time)
259
260
 
260
261
 
262
+ def is_key_pressed_async(vk_code):
263
+ """
264
+ Async check if a key is currently pressed
265
+ vk_code: Virtual Key code (e.g., 0x41 for 'A', 0x1B for ESC)
266
+ Returns: True if pressed, False otherwise
267
+ """
268
+ return win32api.GetAsyncKeyState(vk_code) & 0x8000 != 0
269
+
270
+
261
271
  def scroll(amount, delay=None, post_scroll_delay=None):
262
272
  def raw_scroll(amount):
263
273
  # Constants for mouse input
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zhmiscellany
3
- Version: 5.9.7
3
+ Version: 5.9.9
4
4
  Summary: A collection of useful/interesting python libraries made by zh.
5
5
  Home-page: https://discord.gg/ThBBAuueVJ
6
6
  Author: zh
@@ -42,7 +42,7 @@ Introduction
42
42
 
43
43
  Can be installed with `pip install zhmiscellany`
44
44
 
45
- Currently, the package stands at 147 functions/classes/bindings across 15 modules.
45
+ Currently, the package stands at 148 functions/classes/bindings across 15 modules.
46
46
 
47
47
  The git repository for this package can be found [here](https://github.com/zen-ham/zhmiscellany). The docs also look nicer on github.
48
48
 
@@ -1546,6 +1546,15 @@ Records keyboard and mouse events and generates zhmiscellany.macro code to emula
1546
1546
 
1547
1547
  #
1548
1548
 
1549
+ `zhmiscellany.macro.is_key_pressed_async()`
1550
+ ---
1551
+
1552
+ `zhmiscellany.macro.is_key_pressed_async(vk_code)`
1553
+
1554
+ See if a key is pressed.
1555
+
1556
+ #
1557
+
1549
1558
  ---
1550
1559
  `zhmiscellany.cpp`
1551
1560
  ---
@@ -12,7 +12,7 @@ zhmiscellany/fileio.py,sha256=KmRnWWZJWBc5Or3_mKcRY2ehE_Fuk870iS-imtyERyg,18169
12
12
  zhmiscellany/gui.py,sha256=w1b63jt4qtnnGLImhRXJA5xkjGsKNIT65z0CmwCJgtQ,8939
13
13
  zhmiscellany/image.py,sha256=qUjxiYpc2VVZp2vwr1vN36O2PVQ7YlMKzhegQ1u4c0M,8198
14
14
  zhmiscellany/list.py,sha256=S8Z85bLJEP9lk2JkGpzUcG6kpRB7a-NWDIHMPiF5bKo,1473
15
- zhmiscellany/macro.py,sha256=aTKqx1Sc2MC9lmq0KhCgwr2lilHRlXPDoNiLQiZJ198,26082
15
+ zhmiscellany/macro.py,sha256=wRf02IHEzvyAno2iWr6lb9Bpbwy_lOs9BwTtEKXMbmQ,26426
16
16
  zhmiscellany/math.py,sha256=btOQTe_GvqP0A7Zz84tmN_c8j1NGe_mKnhmAt40lhLU,2482
17
17
  zhmiscellany/misc.py,sha256=BsTbRWlXI5LZBG7Bl2MgLzHESyCMJnr_KNZAf2wY_H4,29689
18
18
  zhmiscellany/netio.py,sha256=GTamo5cJn4P6u8V_kgZ9kL8qeMUE7OQAmYkmj9Sp_GA,2236
@@ -21,7 +21,7 @@ zhmiscellany/pipes.py,sha256=PxO4aykFzC60xbTQuc66KzZYIxiW0KPebXZbncD2HcU,3795
21
21
  zhmiscellany/processing.py,sha256=sDKIbzG9TNFyT6yJ4TJL59taG-59_v3CBLekVSLrwgE,10899
22
22
  zhmiscellany/rust.py,sha256=znN6DYNoa_p-braTuDZKvUnXX8reWLFu_dG4fv2vLR0,442
23
23
  zhmiscellany/string.py,sha256=xyqE6V5YF2nieZDcg5ZrXTIrH2D9oDRbZ5vQGz8rPys,4787
24
- zhmiscellany-5.9.7.dist-info/METADATA,sha256=mnaSIRbwYDuJs_SRhDoaHjTBpo5omaAjYOlFK6ArepA,43321
25
- zhmiscellany-5.9.7.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
26
- zhmiscellany-5.9.7.dist-info/top_level.txt,sha256=ioDtsrevCI52rTxZntMPljRIBsZs73tD0hI00HektiE,13
27
- zhmiscellany-5.9.7.dist-info/RECORD,,
24
+ zhmiscellany-5.9.9.dist-info/METADATA,sha256=n1q5UcKuWJJm2JHU_blNt98tv9NwQ7MNthLAfrU9piE,43460
25
+ zhmiscellany-5.9.9.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
26
+ zhmiscellany-5.9.9.dist-info/top_level.txt,sha256=ioDtsrevCI52rTxZntMPljRIBsZs73tD0hI00HektiE,13
27
+ zhmiscellany-5.9.9.dist-info/RECORD,,