+++ /dev/null
-#!/usr/bin/env python\r
-#\r
-# $Id: ncurses.py 36559 2004-07-18 05:56:09Z tim_one $\r
-#\r
-# Interactive test suite for the curses module.\r
-# This script displays various things and the user should verify whether\r
-# they display correctly.\r
-#\r
-\r
-import curses\r
-from curses import textpad\r
-\r
-def test_textpad(stdscr, insert_mode=False):\r
- ncols, nlines = 8, 3\r
- uly, ulx = 3, 2\r
- if insert_mode:\r
- mode = 'insert mode'\r
- else:\r
- mode = 'overwrite mode'\r
-\r
- stdscr.addstr(uly-3, ulx, "Use Ctrl-G to end editing (%s)." % mode)\r
- stdscr.addstr(uly-2, ulx, "Be sure to try typing in the lower-right corner.")\r
- win = curses.newwin(nlines, ncols, uly, ulx)\r
- textpad.rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)\r
- stdscr.refresh()\r
-\r
- box = textpad.Textbox(win, insert_mode)\r
- contents = box.edit()\r
- stdscr.addstr(uly+ncols+2, 0, "Text entered in the box\n")\r
- stdscr.addstr(repr(contents))\r
- stdscr.addstr('\n')\r
- stdscr.addstr('Press any key')\r
- stdscr.getch()\r
-\r
- for i in range(3):\r
- stdscr.move(uly+ncols+2 + i, 0)\r
- stdscr.clrtoeol()\r
-\r
-def main(stdscr):\r
- stdscr.clear()\r
- test_textpad(stdscr, False)\r
- test_textpad(stdscr, True)\r
-\r
-\r
-if __name__ == '__main__':\r
- curses.wrapper(main)\r