3 # $Id: ncurses.py 36559 2004-07-18 05:56:09Z tim_one $
5 # Interactive test suite for the curses module.
6 # This script displays various things and the user should verify whether
7 # they display correctly.
11 from curses
import textpad
13 def test_textpad(stdscr
, insert_mode
=False):
19 mode
= 'overwrite mode'
21 stdscr
.addstr(uly
-3, ulx
, "Use Ctrl-G to end editing (%s)." % mode
)
22 stdscr
.addstr(uly
-2, ulx
, "Be sure to try typing in the lower-right corner.")
23 win
= curses
.newwin(nlines
, ncols
, uly
, ulx
)
24 textpad
.rectangle(stdscr
, uly
-1, ulx
-1, uly
+ nlines
, ulx
+ ncols
)
27 box
= textpad
.Textbox(win
, insert_mode
)
29 stdscr
.addstr(uly
+ncols
+2, 0, "Text entered in the box\n")
30 stdscr
.addstr(repr(contents
))
32 stdscr
.addstr('Press any key')
36 stdscr
.move(uly
+ncols
+2 + i
, 0)
41 test_textpad(stdscr
, False)
42 test_textpad(stdscr
, True)
45 if __name__
== '__main__':