diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2006-06-03 23:07:21 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2006-06-03 23:07:21 (GMT) |
commit | 311562ac75125ed12c0c1e40f096b70fa9d8356a (patch) | |
tree | b71c51b130907fab334cfa7364ba647dd0a7c33c /Demo | |
parent | 98900bc7bb4ecb01243b079ce975f36524aa3c86 (diff) | |
download | cpython-311562ac75125ed12c0c1e40f096b70fa9d8356a.zip cpython-311562ac75125ed12c0c1e40f096b70fa9d8356a.tar.gz cpython-311562ac75125ed12c0c1e40f096b70fa9d8356a.tar.bz2 |
Use true division, and the True value
Diffstat (limited to 'Demo')
-rw-r--r-- | Demo/curses/tclock.py | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/Demo/curses/tclock.py b/Demo/curses/tclock.py index 1950043..8058d9a 100644 --- a/Demo/curses/tclock.py +++ b/Demo/curses/tclock.py @@ -14,7 +14,8 @@ def sign(_x): return 1 def A2XY(angle, radius): - return int(round(ASPECT * radius * sin(angle))), int(round(radius * cos(angle))) + return (int(round(ASPECT * radius * sin(angle))), + int(round(radius * cos(angle)))) def plot(x, y, col): stdscr.addch(y, x, col) @@ -37,9 +38,9 @@ def dline(pair, from_x, from_y, x2, y2, ch): y = from_y if ax > ay: - d = ay - ax / 2 + d = ay - ax // 2 - while 1: + while True: plot(x, y, ch) if x == x2: return @@ -50,9 +51,9 @@ def dline(pair, from_x, from_y, x2, y2, ch): x += sx d += ay else: - d = ax - ay / 2 + d = ax - ay // 2 - while 1: + while True: plot(x, y, ch) if y == y2: return @@ -78,12 +79,12 @@ def main(win): curses.init_pair(2, curses.COLOR_MAGENTA, my_bg) curses.init_pair(3, curses.COLOR_GREEN, my_bg) - cx = (curses.COLS - 1) / 2 - cy = curses.LINES / 2 - ch = min( cy-1, int(cx / ASPECT) - 1) - mradius = (3 * ch) / 4 - hradius = ch / 2 - sradius = 5 * ch / 6 + cx = (curses.COLS - 1) // 2 + cy = curses.LINES // 2 + 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 @@ -96,7 +97,7 @@ def main(win): sradius = max(sradius-4, 8) - while 1: + while True: curses.napms(1000) tim = time.time() |