Skip to content

Commit 8b5ae60

Browse files
committed
Added pep talk generator
1 parent 54dd247 commit 8b5ae60

File tree

8 files changed

+27796
-0
lines changed

8 files changed

+27796
-0
lines changed
113 KB
Binary file not shown.

Pep_Talk_Generator/clue/code.py

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
from adafruit_clue import clue
2+
import random
3+
import displayio
4+
from adafruit_display_text import label, wrap_text_to_pixels
5+
from adafruit_bitmap_font import bitmap_font
6+
import board
7+
8+
column_1 = [
9+
"Champ, ",
10+
"Fact: ",
11+
"Everybody says ",
12+
"Dang... ",
13+
"Check it: ",
14+
"Just saying... ",
15+
"Superstar, ",
16+
"Tiger, ",
17+
"Self, ",
18+
"Know this: ",
19+
"News alert: ",
20+
"Girl, ",
21+
"Ace, ",
22+
"Excuse me but ",
23+
"Experts agree: ",
24+
"In my opinion, ",
25+
"Hear ye, hear ye: ",
26+
"Okay, listen up: ",
27+
]
28+
29+
column_2 = [
30+
"the mere idea of you ",
31+
"your soul ",
32+
"your hair today ",
33+
"everything you do ",
34+
"your personal style ",
35+
"every thought you have ",
36+
"that sparkle in your eye ",
37+
"your presence here ",
38+
"what you got going on ",
39+
"the essential you ",
40+
"your life's journey ",
41+
"that saucy personality ",
42+
"your DNA ",
43+
"that brain of yours ",
44+
"your choice of attire ",
45+
"the way you roll ",
46+
"whatever your secret is ",
47+
"all of y'all ",
48+
]
49+
50+
column_3 = [
51+
"has serious game, ",
52+
"rains magic, ",
53+
"deserves the Nobel Prize, ",
54+
"raises the roof, ",
55+
"breeds miracles, ",
56+
"is paying off big time, ",
57+
"shows mad skills, ",
58+
"just shimmers, ",
59+
"is a national treasure, ",
60+
"gets the party hopping, ",
61+
"is the next big thing, ",
62+
"roars like a lion, ",
63+
"is a rainbow factory, ",
64+
"is made of diamonds, ",
65+
"makes birds sing, ",
66+
"should be taught in school, ",
67+
"makes my world go 'round, ",
68+
"is 100% legit, ",
69+
]
70+
71+
column_4 = [
72+
"24/7.",
73+
"can I get an amen?",
74+
"and that's a fact.",
75+
"so treat yourself.",
76+
"you feel me?",
77+
"that's just science.",
78+
"would I lie?",
79+
"for reals.",
80+
"mic drop.",
81+
"you hidden gem.",
82+
"snuggle bear.",
83+
"period.",
84+
"can I get an amen?",
85+
"now let's dance.",
86+
"high five.",
87+
"say it again!",
88+
"according to CNN.",
89+
"so get used to it.",
90+
]
91+
92+
arial18 = bitmap_font.load_font("/fonts/Arial-18.bdf")
93+
arial12 = bitmap_font.load_font("/fonts/Arial-12.bdf")
94+
95+
arial18.load_glyphs(
96+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789;,./?><=+[{]}-_"
97+
)
98+
arial12.load_glyphs(
99+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789;,./?><=+[{]}-_"
100+
)
101+
102+
display = board.DISPLAY
103+
clue_group = displayio.Group()
104+
105+
bitmap_file = open("bmps/background.bmp", "rb")
106+
bitmap1 = displayio.OnDiskBitmap(bitmap_file)
107+
tile_grid = displayio.TileGrid(
108+
bitmap1, pixel_shader=getattr(bitmap1, "pixel_shader", displayio.ColorConverter())
109+
)
110+
clue_group.append(tile_grid)
111+
112+
text = "\n".join(
113+
wrap_text_to_pixels(
114+
random.choice(column_1)
115+
+ random.choice(column_2)
116+
+ random.choice(column_3)
117+
+ random.choice(column_4),
118+
180,
119+
arial18,
120+
)
121+
)
122+
pep = label.Label(
123+
font=arial18,
124+
text=text,
125+
anchor_point=(0.5, 0.5),
126+
anchored_position=(120, 115),
127+
line_spacing=0.8,
128+
color=0x000000,
129+
)
130+
clue_group.append(pep)
131+
132+
title = label.Label(
133+
font=arial12,
134+
text="Pep talk generator",
135+
anchor_point=(0.5, 0.5),
136+
anchored_position=(120, 231),
137+
color=0x000000,
138+
)
139+
clue_group.append(title)
140+
141+
display.show(clue_group)
142+
143+
while True:
144+
if clue.button_a or clue.button_b:
145+
pep.text = "\n".join(
146+
wrap_text_to_pixels(
147+
random.choice(column_1)
148+
+ random.choice(column_2)
149+
+ random.choice(column_3)
150+
+ random.choice(column_4),
151+
180,
152+
arial18,
153+
)
154+
)

0 commit comments

Comments
 (0)