Mouse presses not registering in windows-curses in terminal, but do in standalone CMD #11918

Open
opened 2026-01-31 03:01:02 +00:00 by claunia · 0 comments
Owner

Originally created by @jwlodek on GitHub (Dec 30, 2020).

Environment

E:\>ver

Microsoft Windows [Version 10.0.18363.1256]

E:\>py --version
Python 3.7.0

E:\>pip freeze | grep curses
windows-curses==2.1.0

Steps to reproduce

Install windows curses:

pip install windows-curses

Run the following script:

import curses

screen = curses.initscr()
#curses.noecho()
curses.curs_set(0)
screen.keypad(1)
curses.mousemask(1)

screen.addstr("This is a Sample Curses Script\n\n")

while True:
    event = screen.getch()
    if event == ord("q"): break
    if event == curses.KEY_MOUSE:
        _, mx, my, _, _ = curses.getmouse()
        y, x = screen.getyx()
        screen.addstr(f"Mouse location:{mx}, {my}\n\n")

curses.endwin()

in command prompt, and then in windows terminal.

Click the mouse in random locations around the screen.

Expected behavior

Mouse presses detected and printed to screen (see screenshot from CMD):
image

Actual behavior

No mouse presses detected and nothing printed to screen.

Originally created by @jwlodek on GitHub (Dec 30, 2020). # Environment ```none E:\>ver Microsoft Windows [Version 10.0.18363.1256] E:\>py --version Python 3.7.0 E:\>pip freeze | grep curses windows-curses==2.1.0 ``` # Steps to reproduce Install windows curses: ``` pip install windows-curses ``` Run the following script: ```Python import curses screen = curses.initscr() #curses.noecho() curses.curs_set(0) screen.keypad(1) curses.mousemask(1) screen.addstr("This is a Sample Curses Script\n\n") while True: event = screen.getch() if event == ord("q"): break if event == curses.KEY_MOUSE: _, mx, my, _, _ = curses.getmouse() y, x = screen.getyx() screen.addstr(f"Mouse location:{mx}, {my}\n\n") curses.endwin() ``` in command prompt, and then in windows terminal. Click the mouse in random locations around the screen. # Expected behavior Mouse presses detected and printed to screen (see screenshot from CMD): ![image](https://user-images.githubusercontent.com/29227305/103380500-1105de80-4ab7-11eb-8689-5b35275b0913.png) # Actual behavior No mouse presses detected and nothing printed to screen.
claunia added the Resolution-Duplicate label 2026-01-31 03:01:02 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11918