'python curses, how to use control, shift keys?
I am currently making a python project in curses, I want to know how to use the control and shift keys using stdscr.getch(), the other keys work, except for a few keys including ctrl and shift.
The code for the files look like this
# script_1.py
import curses
stdscr = curses.initscr()
curses.noecho()
curses.curs_set(False)
curses.start_color()
stdscr.keypad(True)
curses.mousemask(True)
# script_2.py
from script_1 import *
cmd = stdscr.getch()
if cmd == curses.KEY_CONTROL_L:
print("You pressed Left Control") # This code won't work
elif cmd == curses.KEY_SHIFT_L:
print("You pressed Left Shift") # This code won't work
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
