zeth/inputs

get_mouse blocks before first execution

Opened this issue · 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

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.

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