summaryrefslogtreecommitdiffstats
path: root/Demo/curses/tclock.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2000-12-23 14:50:18 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2000-12-23 14:50:18 (GMT)
commit994d8539f690c19f7dcd02c9f595734e9d566e76 (patch)
tree1ac98080d7abf9e4a8d4f50aff0b856a5e8fbf01 /Demo/curses/tclock.py
parent49d27c82e62a555d415aaf63562fd22971a2961d (diff)
downloadcpython-994d8539f690c19f7dcd02c9f595734e9d566e76.zip
cpython-994d8539f690c19f7dcd02c9f595734e9d566e76.tar.gz
cpython-994d8539f690c19f7dcd02c9f595734e9d566e76.tar.bz2
Choose the smallest value of x,y for the clock's radius (instead of just taking the
y coordinate), and change radius of second indicator to compensate Remove redundant setting of sradius
Diffstat (limited to 'Demo/curses/tclock.py')
-rw-r--r--Demo/curses/tclock.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/Demo/curses/tclock.py b/Demo/curses/tclock.py
index adc0056..f423e9a 100644
--- a/Demo/curses/tclock.py
+++ b/Demo/curses/tclock.py
@@ -80,17 +80,13 @@ def main(win):
cx = (curses.COLS - 1) / 2
cy = curses.LINES / 2
- if cx > cy:
- ch = cy
- else:
- ch = cx
- mradius = (3 * cy) / 4
- hradius = cy / 2
- sradius = (2 * cy) / 3
+ ch = min( cy-1, int(cx / ASPECT) - 1)
+ mradius = (3 * ch) / 4
+ hradius = ch / 2
+ sradius = 5 * ch / 6
for i in range(0, 12):
sangle = (i + 1) * 2.0 * pi / 12.0
- sradius = 5 * cy / 6
sdx, sdy = A2XY(sangle, sradius)
stdscr.addstr(cy - sdy, cx + sdx, "%d" % (i + 1))
@@ -98,7 +94,8 @@ def main(win):
stdscr.addstr(0, 0,
"ASCII Clock by Howard Jones <ha.jones@ic.ac.uk>, 1994")
- sradius = 8
+ sradius = max(sradius-4, 8)
+
while 1:
curses.napms(1000)