Skip to content

Instantly share code, notes, and snippets.

@FlandreDaisuki
Forked from myano/cs.py
Created January 18, 2018 10:16
Show Gist options
  • Save FlandreDaisuki/53d5d7dc847b019446c464ebfcbd47db to your computer and use it in GitHub Desktop.
Save FlandreDaisuki/53d5d7dc847b019446c464ebfcbd47db to your computer and use it in GitHub Desktop.
Quick example of ncurses in Python!
#!/usr/bin/env python
import curses
import curses.textpad
import time
stdscr = curses.initscr()
#curses.noecho()
#curses.echo()
begin_x = 20
begin_y = 7
height = 5
width = 40
win = curses.newwin(height, width, begin_y, begin_x)
tb = curses.textpad.Textbox(win)
text = tb.edit()
curses.addstr(4,1,text.encode('utf_8'))
#hw = "Hello world!"
#while 1:
# c = stdscr.getch()
# if c == ord('p'):
# elif c == ord('q'): break # Exit the while()
# elif c == curses.KEY_HOME: x = y = 0
curses.endwin()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment