0

Unable to use the curses module in Pycharm even after successful installation of it in terminal. Also installed windows-curses package in Pycharm. import curses code is greyed out. When I run it in the pycharm terminal, none of the code is executed. Appreciate any help as I'm new to programming! Thanks!

import curses
from curses import wrapper

def main(stdscr):
    stdscr.clear()
    stdscr.addstr('Hello World!')
    stdscr.getch()
    stdscr.refresh()

wrapper(main)
Jorge Luis
  • 813
  • 6
  • 21
jeoyekun
  • 1
  • 1

1 Answers1

1

You need to check some additional settings in an IDE. Try next (look at pic): enter image description here

  • Thank you so much, it works ! :) May I know however if there's a way to run the code on the windows cmd terminal itself? Not really used to the pycharm terminal, and every time I run a code on the windows terminal (cmd) it always brings me straight to the pycharm terminal. – jeoyekun May 31 '23 at 16:27
  • You can run the code in win terminal. Type: python -c "import curses; stdscr = curses.initscr(); stdscr.addstr(0, 0, 'Hello World!'); stdscr.refresh(); stdscr.getch(); curses.endwin()" and press Enter. But I rather advice you to use IDE :) – Nicholas W. Jun 01 '23 at 07:24