summaryrefslogtreecommitdiffstats
path: root/Tools/demo/hanoi.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-12-30 22:11:50 (GMT)
committerGeorg Brandl <georg@python.org>2010-12-30 22:11:50 (GMT)
commit856898b3958626d2400e59b53dc134283addc988 (patch)
tree2018f1418921ad20ef0fce86f9e28df09c3e5567 /Tools/demo/hanoi.py
parenta3fe8e0b9face74e34b938dd657c4048d5f0dadf (diff)
downloadcpython-856898b3958626d2400e59b53dc134283addc988.zip
cpython-856898b3958626d2400e59b53dc134283addc988.tar.gz
cpython-856898b3958626d2400e59b53dc134283addc988.tar.bz2
Harmonize docstrings. Move redemo from Tools/scripts to Tools/demo. Add a README file to Tools/demo.
Diffstat (limited to 'Tools/demo/hanoi.py')
-rwxr-xr-x[-rw-r--r--]Tools/demo/hanoi.py26
1 files changed, 13 insertions, 13 deletions
diff --git a/Tools/demo/hanoi.py b/Tools/demo/hanoi.py
index 34a0bba..dad0234 100644..100755
--- a/Tools/demo/hanoi.py
+++ b/Tools/demo/hanoi.py
@@ -1,17 +1,18 @@
-# Animated Towers of Hanoi using Tk with optional bitmap file in
-# background.
-#
-# Usage: tkhanoi [n [bitmapfile]]
-#
-# n is the number of pieces to animate; default is 4, maximum 15.
-#
-# The bitmap file can be any X11 bitmap file (look in
-# /usr/include/X11/bitmaps for samples); it is displayed as the
-# background of the animation. Default is no bitmap.
+#!/usr/bin/env python3
-# This uses Steen Lumholt's Tk interface
-from tkinter import *
+"""
+Animated Towers of Hanoi using Tk with optional bitmap file in background.
+Usage: hanoi.py [n [bitmapfile]]
+
+n is the number of pieces to animate; default is 4, maximum 15.
+
+The bitmap file can be any X11 bitmap file (look in /usr/include/X11/bitmaps for
+samples); it is displayed as the background of the animation. Default is no
+bitmap.
+"""
+
+from tkinter import Tk, Canvas
# Basic Towers-of-Hanoi algorithm: move n pieces from a to b, using c
# as temporary. For each move, call report()
@@ -123,7 +124,6 @@ class Tkhanoi:
self.pegstate[b].append(i)
-# Main program
def main():
import sys