summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1996-12-30 16:45:14 (GMT)
committerGuido van Rossum <guido@python.org>1996-12-30 16:45:14 (GMT)
commitb5846d7600709e64ca3e5adc7a35ec789e7238ef (patch)
treee728da360433c4c895da52b3eb6e7febe8510ae2
parent408027ea4635de5c892b28c4fdf41840eb9089a4 (diff)
downloadcpython-b5846d7600709e64ca3e5adc7a35ec789e7238ef.zip
cpython-b5846d7600709e64ca3e5adc7a35ec789e7238ef.tar.gz
cpython-b5846d7600709e64ca3e5adc7a35ec789e7238ef.tar.bz2
A different winning animation.
-rwxr-xr-xDemo/tkinter/guido/solitaire.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/Demo/tkinter/guido/solitaire.py b/Demo/tkinter/guido/solitaire.py
index 361eb6b..bd7328d 100755
--- a/Demo/tkinter/guido/solitaire.py
+++ b/Demo/tkinter/guido/solitaire.py
@@ -580,14 +580,16 @@ class Solitaire:
def win(self):
"""Stupid animation when you win."""
cards = []
- for s in self.suits:
+ for s in self.openstacks:
cards = cards + s.cards
- if not cards:
- return
- for i in range(1000):
+ while cards:
card = random.choice(cards)
- dx = random.randint(-50, 50)
- dy = random.randint(-50, 50)
+ cards.remove(card)
+ self.animatedmoveto(card, self.deck)
+
+ def animatedmoveto(self, card, dest):
+ for i in range(10, 0, -1):
+ dx, dy = (dest.x-card.x)/i, (dest.y-card.y)/i
card.moveby(dx, dy)
self.master.update_idletasks()