Commit a4aeb336 authored by Julin S's avatar Julin S Committed by Raymond Hettinger

bpo-38539: Update demo files (GH-16890)

parent 20bf8e08
......@@ -12,5 +12,5 @@ redemo.py Regular Expressions: GUI script to test regexes.
rpython.py Network programming: Small client for remote code execution.
rpythond.py Network programming: Small server for remote code execution.
sortvisu.py GUI programming: Visualization of different sort algorithms.
ss1.py GUI/Application programming: A simple spreadsheet application.
vector.py Python basics: A vector class with demonstrating special methods.
\ No newline at end of file
spreadsheet.py GUI/Application programming: A simple spreadsheet application.
vector.py Python basics: A vector class demonstrating special methods.
......@@ -27,7 +27,7 @@ def hanoi(n, a, b, c, report):
class Tkhanoi:
# Create our objects
def __init__(self, n, bitmap = None):
def __init__(self, n, bitmap=None):
self.n = n
self.tk = tk = Tk()
self.canvas = c = Canvas(tk)
......@@ -77,7 +77,7 @@ class Tkhanoi:
# Run -- never returns
def run(self):
while 1:
while True:
hanoi(self.n, 0, 1, 2, self.report)
hanoi(self.n, 1, 2, 0, self.report)
hanoi(self.n, 2, 0, 1, self.report)
......@@ -94,7 +94,7 @@ class Tkhanoi:
# Lift the piece above peg a
ax1, ay1, ax2, ay2 = c.bbox(self.pegs[a])
while 1:
while True:
x1, y1, x2, y2 = c.bbox(p)
if y2 < ay1: break
c.move(p, 0, -1)
......@@ -103,7 +103,7 @@ class Tkhanoi:
# Move it towards peg b
bx1, by1, bx2, by2 = c.bbox(self.pegs[b])
newcenter = (bx1+bx2)//2
while 1:
while True:
x1, y1, x2, y2 = c.bbox(p)
center = (x1+x2)//2
if center == newcenter: break
......@@ -114,7 +114,7 @@ class Tkhanoi:
# Move it down on top of the previous piece
pieceheight = y2-y1
newbottom = by2 - pieceheight*len(self.pegstate[b]) - 2
while 1:
while True:
x1, y1, x2, y2 = c.bbox(p)
if y2 >= newbottom: break
c.move(p, 0, 1)
......
......@@ -29,7 +29,7 @@ def main():
with conn:
print('connection from', remotehost, remoteport)
request = b''
while 1:
while True:
data = conn.recv(BUFSIZE)
if not data:
break
......
......@@ -444,7 +444,7 @@ def quicksort(array):
array.wait(1000)
left = first
right = last
while 1:
while True:
array.message("Sweep right pointer")
right = right-1
array.show_right(right)
......@@ -473,7 +473,7 @@ def quicksort(array):
array.hide_partition()
def demosort(array):
while 1:
while True:
for alg in [quicksort, insertionsort, selectionsort, bubblesort]:
randomize(array)
alg(array)
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment