blob: c01f53f0bf36bdf7cbad90c13683609a6af6999e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
Python module to page screen output and get dimensions
of available console space.
It is meant to be finally included into standard library
http://bugs.python.org/issue8408
| Author: anatoly techtonik <techtonik@gmail.com>
| License: Public Domain (or MIT if a license is required)
Status
------
0.1 (stable)
- shows content page by page
- allows to get console/terminal dimensions
- works on Windows
- works on Linux
API
---
..function:: getwidth()
Return width of available window in characters. If detection fails,
return value of standard width 80. Coordinate of the last character
on a line is -1 from returned value.
..function:: getheight()
Return available window height in characters or 25 if detection fails.
Coordinate of the last line is -1 from returned value.
..function:: getch()
Wait for keypress and return character in a cross-platform way.
Credits: Danny Yoo, Python Cookbook
..function:: page(content, [pagecallback=prompt])
Output `content` iterable, calling `pagecallback` function after each
page. Default :func:`prompt` callback shows 'Press any key . . . ' prompt
and waits for keypress.
References
----------
Excellent tutorials for Win32 Console by Adrian Worley
http://www.adrianxw.dk/SoftwareSite/index.html
Console Reference on MSDN
http://msdn.microsoft.com/en-us/library/ms682087%28VS.85%29.aspx
Public Domain Curses library maintained by William McBrine
http://pdcurses.sourceforge.net/
Ioctl (input/output control) introduction from Wikipedia
http://en.wikipedia.org/wiki/Ioctl
Linux Programmer's Manual - ioctls for terminals and serial lines
http://www.kernel.org/doc/man-pages/online/pages/man4/tty_ioctl.4.html
|