0

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

wjandrea
  • 28,235
  • 9
  • 60
  • 81
kible
  • 31
  • 5

0 Answers0