[Python-checkins] python/dist/src/Lib/curses textpad.py,1.8,1.9

akuchling at users.sourceforge.net akuchling at users.sourceforge.net
Tue Oct 19 21:21:22 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib/curses
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30494

Modified Files:
	textpad.py 
Log Message:
Make magic coordinates more readable

Index: textpad.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/curses/textpad.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- textpad.py	29 Sep 2002 00:25:51 -0000	1.8
+++ textpad.py	19 Oct 2004 19:21:20 -0000	1.9
@@ -3,7 +3,9 @@
 import curses, ascii
 
 def rectangle(win, uly, ulx, lry, lrx):
-    "Draw a rectangle."
+    """Draw a rectangle with corners at the provided upper-left
+    and lower-right coordinates.
+    """
     win.vline(uly+1, ulx, curses.ACS_VLINE, lry - uly - 1)
     win.hline(uly, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
     win.hline(lry, ulx+1, curses.ACS_HLINE, lrx - ulx - 1)
@@ -157,8 +159,10 @@
 
 if __name__ == '__main__':
     def test_editbox(stdscr):
-        win = curses.newwin(4, 9, 15, 20)
-        rectangle(stdscr, 14, 19, 19, 29)
+        ncols, nlines = 9, 4
+        uly, ulx = 15, 20
+        win = curses.newwin(nlines, ncols, uly, ulx)
+        rectangle(stdscr, uly-1, ulx-1, uly + nlines, ulx + ncols)
         stdscr.refresh()
         return Textbox(win).edit()
 



More information about the Python-checkins mailing list