inputs icon indicating copy to clipboard operation
inputs copied to clipboard

get_mouse blocks before first execution

Open frastlin opened this issue 6 years ago • 2 comments

Problem

def run():
	events = get_mouse()
	for event in events:
		print(event.__dict__)

	while True:
		run()
		print("new loop")

With the above code, "new loop" will not print until after the first event is triggered.

What should happen

"new loop" should print when the application starts and continue printing until the application stops. If one does get_key with the above code, the proper result happens.

Other Information

OS: Windows 10 64 bit python 3.6

frastlin avatar Dec 23 '18 05:12 frastlin

Hello, So after looking at the code, the problem is around line 2609 on the last line of the _get_data function:

def _get_data(self, read_size):
	"""Get data from the character device."""
	if NIX:
		return super(Mouse, self)._get_data(read_size)
	return self._pipe.recv_bytes()

Something is going on with the pipe for mouse events that keeps the process from exiting before a mouse event happens for the first time. The process also freezes again after the app has been running for a while.

frastlin avatar Dec 24 '18 06:12 frastlin

Hey! Look at issue #7 , I found a solution that worked for me

ErikOrjehag avatar Feb 05 '20 21:02 ErikOrjehag