sort into folders
This commit is contained in:
C&C++
1st_day_of_month.cppJJbY.cppTp6G.cppalternatice_bracket.c
autoconfig
c.phpc_old_argument_notation.ccnn.ccomp.cconditional_const.cconst.ccpp_regex_error.cppcurrent_year.cppdda2.cppdog.jpgdog2.jpgelse_while.cflex
for_ctags.cppfree_null.cgcc_include_next.cgdb_graph.cgetopt_test.cgnu_decimals.cgnu_history.cgnu_regex.cgnu_regex2.cheader.hindex_in_initializer_list_compiler_extension.cknr.clevenshtein_dist_-_usage.cpplinking
map_initialization.cppncurses_labels.cncurses_mv_win.cppncurses_plus_readline.cppncurses_resize2.cppncurses_resize_hello_world.cppncurses_resize_test.cncurses_scroll.cnf.cnull_printf.cnull_printf.cppportable_namespace.cportable_namespace.hpta.cscoping_showcase.cscreen_size_(without_curses).csdl_render_to_texture.cppsentinel_pack.csetjmp_test.cppstrdup.ctcc_int.ctest.ctypedef.cunctrl.cundefined_reference.cusb.cvasprintf.cvoid_main.cx.cppxtermio.cxtp.cppMisc.
bind_test.sh
cross_compile
example.m4extension_cut.Makefilefizzbuzz.f90gdb_pretty_print
guards.hstest.infotest.texiPython
ascii_injection.pyascii_nn_input_helper.pydpt.pyformat.pygraph.pygroup.pyint_memory.ctype.pyint_memory.py.pyotest.pytkinter_filepicker_test.pytorus.py
Vim
Webdev
46
Python/otest.py
Executable file
46
Python/otest.py
Executable file
@ -0,0 +1,46 @@
|
||||
#!/bin/python3
|
||||
|
||||
|
||||
#from pynput import mouse
|
||||
#
|
||||
#class TrackpadTapDetector:
|
||||
# def __init__(self):
|
||||
# self.tap_positions = {'top_left': None, 'top_right': None, 'bottom_left': None, 'bottom_right': None}
|
||||
#
|
||||
# def on_click(self, x, y, button, pressed):
|
||||
# if pressed:
|
||||
# # Record the position of the tap
|
||||
# self.tap_positions[button] = (x, y)
|
||||
# else:
|
||||
# # Check if it's a release and print information
|
||||
# if self.tap_positions[button]:
|
||||
# release_x, release_y = x, y
|
||||
# tap_x, tap_y = self.tap_positions[button]
|
||||
# print(f'Tap at ({tap_x}, {tap_y}) released at ({release_x}, {release_y}) with {button}')
|
||||
# # Reset the tap position
|
||||
# self.tap_positions[button] = None
|
||||
#
|
||||
## Create an instance of the TrackpadTapDetector
|
||||
#tap_detector = TrackpadTapDetector()
|
||||
#
|
||||
## Create a mouse listener with the custom on_click method
|
||||
#with mouse.Listener(on_click=tap_detector.on_click) as listener:
|
||||
# print('Listening to trackpad tap events...')
|
||||
# listener.join()
|
||||
|
||||
from pynput import mouse
|
||||
|
||||
def on_move(x, y):
|
||||
print(f'Mouse moved to ({x}, {y})')
|
||||
|
||||
def on_click(x, y, button, pressed):
|
||||
action = 'pressed' if pressed else 'released'
|
||||
print(f'Mouse {action} at ({x}, {y}) with {button}')
|
||||
|
||||
def on_scroll(x, y, dx, dy):
|
||||
print(f'Scrolled at ({x}, {y}) with delta ({dx}, {dy})')
|
||||
|
||||
# Create a mouse listener
|
||||
with mouse.Listener(on_move=on_move, on_click=on_click, on_scroll=on_scroll) as listener:
|
||||
print('Listening to trackpad events...')
|
||||
listener.join()
|
Reference in New Issue
Block a user