awacke1 commited on
Commit
cc993c7
·
1 Parent(s): dc70674

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -18
app.py CHANGED
@@ -13,12 +13,6 @@ CARD_HEIGHT = 100
13
  CANVAS_WIDTH = CARD_WIDTH * 13
14
  CANVAS_HEIGHT = CARD_HEIGHT * 4
15
 
16
- # Load the SVG pictures for the card suits
17
- club = svgwrite.image.Image("https://upload.wikimedia.org/wikipedia/commons/2/25/Svg_deck_01.svg", size=(40, 40))
18
- diamond = svgwrite.image.Image("https://upload.wikimedia.org/wikipedia/commons/9/9f/Svg_deck_03.svg", size=(40, 40))
19
- heart = svgwrite.image.Image("https://upload.wikimedia.org/wikipedia/commons/f/f7/Svg_deck_05.svg", size=(40, 40))
20
- spade = svgwrite.image.Image("https://upload.wikimedia.org/wikipedia/commons/e/eb/Svg_deck_06.svg", size=(40, 40))
21
-
22
  # Create a new SVG drawing
23
  dwg = svgwrite.Drawing(size=(f"{CANVAS_WIDTH}px", f"{CANVAS_HEIGHT}px"))
24
 
@@ -32,18 +26,9 @@ for suit_idx, suit in enumerate(suits):
32
  # Draw the card border
33
  dwg.add(dwg.rect((x, y), (CARD_WIDTH, CARD_HEIGHT), rx=10, ry=10, fill="white", stroke="black", stroke_width=2))
34
 
35
- # Draw the card suit picture
36
- suit_picture = None
37
- if suit == "clubs":
38
- suit_picture = club
39
- elif suit == "diamonds":
40
- suit_picture = diamond
41
- elif suit == "hearts":
42
- suit_picture = heart
43
- elif suit == "spades":
44
- suit_picture = spade
45
- suit_picture.translate(x + CARD_WIDTH // 2 - 20, y + CARD_HEIGHT // 2 - 20)
46
- dwg.add(suit_picture)
47
 
48
  # Draw the card value
49
  value = svgwrite.text.Text(value, insert=(x + 5, y + CARD_HEIGHT - 10), fill="black", font_size="16px", font_weight="bold")
 
13
  CANVAS_WIDTH = CARD_WIDTH * 13
14
  CANVAS_HEIGHT = CARD_HEIGHT * 4
15
 
 
 
 
 
 
 
16
  # Create a new SVG drawing
17
  dwg = svgwrite.Drawing(size=(f"{CANVAS_WIDTH}px", f"{CANVAS_HEIGHT}px"))
18
 
 
26
  # Draw the card border
27
  dwg.add(dwg.rect((x, y), (CARD_WIDTH, CARD_HEIGHT), rx=10, ry=10, fill="white", stroke="black", stroke_width=2))
28
 
29
+ # Draw the card suit symbol
30
+ symbol = svgwrite.text.Text(suit.upper(), insert=(x + 5, y + 15), fill="black", font_size="16px", font_weight="bold")
31
+ dwg.add(symbol)
 
 
 
 
 
 
 
 
 
32
 
33
  # Draw the card value
34
  value = svgwrite.text.Text(value, insert=(x + 5, y + CARD_HEIGHT - 10), fill="black", font_size="16px", font_weight="bold")