prompt-toolkit / python-prompt-toolkit

Library for building powerful interactive command line applications in Python
https://python-prompt-toolkit.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
9.25k stars 714 forks source link

Mouse is not responding in Windows 10 #1177

Open noword opened 4 years ago

noword commented 4 years ago

I use a computer installed Windows 10 enterprise ltsc 2019. Mouse is not responding on it.

It's weird,cause another computer installed Windows 10 pro is totally fine.

Finally I figure it out. In 'key_binding/bindings/mouse.py' line 133:

        from prompt_toolkit.output.win32 import Win32Output

        if isinstance(output, Win32Output):

should be

        from prompt_toolkit.output.win32 import Win32Output
        from prompt_toolkit.output.windows10 import Windows10_Output

        if isinstance(output, Win32Output) or isinstance(output, Windows10_Output):

Thank you for this great project.

noword commented 4 years ago

update: The Windows 10 pro was installed the old version prompt_toolkit. I guess the old version hasn't Windows10_Output yet.

625781186 commented 4 years ago

update: The Windows 10 pro was installed the old version prompt_toolkit. I guess the old version hasn't Windows10_Output yet.

My prompt_toolkit version : 3.0.6

still has this bug.

image

I add raise at line 133 , but it doesn't seem to be triggered.

EricBalingit commented 4 years ago

Interesting this worked for you, I didn't see this when I posted #1232

From what I saw it looks like mouse support should be enabled on the input handle mode not the output.

It makes sense if you consider that Windows API is designed to allow nested windowed text UI.

My guess was that mouse events land on the output by default but can be disabled and are disabled on the input by default apparently in some versions of windows.

But I'll give this a try.

EricBalingit commented 4 years ago

I tried this but it did not work for me.

I will work on it this weekend and see if my guess in the previous comment is correct.

Follow #1232

If I can get it working that way I'll make a pull request.