mirror of
https://github.com/python/cpython.git
synced 2025-11-02 19:12:55 +00:00
A different winning animation.
This commit is contained in:
parent
408027ea46
commit
b5846d7600
1 changed files with 8 additions and 6 deletions
|
|
@ -580,14 +580,16 @@ class Solitaire:
|
||||||
def win(self):
|
def win(self):
|
||||||
"""Stupid animation when you win."""
|
"""Stupid animation when you win."""
|
||||||
cards = []
|
cards = []
|
||||||
for s in self.suits:
|
for s in self.openstacks:
|
||||||
cards = cards + s.cards
|
cards = cards + s.cards
|
||||||
if not cards:
|
while cards:
|
||||||
return
|
|
||||||
for i in range(1000):
|
|
||||||
card = random.choice(cards)
|
card = random.choice(cards)
|
||||||
dx = random.randint(-50, 50)
|
cards.remove(card)
|
||||||
dy = random.randint(-50, 50)
|
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)
|
card.moveby(dx, dy)
|
||||||
self.master.update_idletasks()
|
self.master.update_idletasks()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue