Skip to content

Commit c48cdb7

Browse files
committed
Added floating_text.py
1 parent e6f7284 commit c48cdb7

File tree

1 file changed

+188
-0
lines changed

1 file changed

+188
-0
lines changed

floating_text/floating_text.py

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
import os
2+
import time
3+
4+
width =79
5+
6+
text = raw_input("Enter the text: ").upper()
7+
8+
printedtext = [ "","","","","" ]
9+
10+
characters = { " " : [ " ",
11+
" ",
12+
" ",
13+
" ",
14+
" " ],
15+
16+
"A" : [ " * ",
17+
" * * ",
18+
"* *",
19+
"*****",
20+
"* *" ],
21+
22+
"B" : [ "**** ",
23+
"* *",
24+
"**** ",
25+
"* *",
26+
"**** " ],
27+
28+
"C" : [ " ****",
29+
"* ",
30+
"* ",
31+
"* ",
32+
" ****" ],
33+
34+
"D" : [ "**** ",
35+
"* *",
36+
"* *",
37+
"* *",
38+
"**** " ],
39+
40+
"E" : [ "*****",
41+
"* ",
42+
"*****",
43+
"* ",
44+
"*****" ],
45+
46+
"F" : [ "*****",
47+
"* ",
48+
"*****",
49+
"* ",
50+
"* " ],
51+
52+
"G" : [ " ****",
53+
"* ",
54+
"* ***",
55+
"* *",
56+
" ****" ],
57+
58+
"H" : [ "* *",
59+
"* *",
60+
"*****",
61+
"* *",
62+
"* *" ],
63+
64+
"I" : [ "*****",
65+
" * ",
66+
" * ",
67+
" * ",
68+
"*****" ],
69+
70+
"J" : [ "*****",
71+
" * ",
72+
" * ",
73+
"* * ",
74+
"**** " ],
75+
76+
"K" : [ "* *",
77+
"* * ",
78+
"*** ",
79+
"* * ",
80+
"* *" ],
81+
82+
"L" : [ "* ",
83+
"* ",
84+
"* ",
85+
"* ",
86+
"*****" ],
87+
88+
"M" : [ "* *",
89+
"** **",
90+
"* * *",
91+
"* *",
92+
"* *" ],
93+
94+
"N" : [ "* *",
95+
"** *",
96+
"* * *",
97+
"* **",
98+
"* *" ],
99+
100+
"O" : [ " *** ",
101+
"* *",
102+
"* *",
103+
"* *",
104+
" *** " ],
105+
106+
"P" : [ "**** ",
107+
"* *",
108+
"**** ",
109+
"* ",
110+
"* " ],
111+
112+
"Q" : [ " *** ",
113+
"** *",
114+
"* * *",
115+
" *** ",
116+
" * " ],
117+
118+
"R" : [ "**** ",
119+
"* *",
120+
"**** ",
121+
"* * ",
122+
"* *" ],
123+
124+
"S" : [ " ****",
125+
"* ",
126+
" *** ",
127+
" *",
128+
"**** " ],
129+
130+
"T" : [ "*****",
131+
" * ",
132+
" * ",
133+
" * ",
134+
" * " ],
135+
136+
"U" : [ "* *",
137+
"* *",
138+
"* *",
139+
"* *",
140+
" *** " ],
141+
142+
"V" : [ "* *",
143+
"* *",
144+
"* *",
145+
" * * ",
146+
" * " ],
147+
148+
"W" : [ "* *",
149+
"* *",
150+
"* * *",
151+
"** **",
152+
"* *" ],
153+
154+
"X" : [ "* *",
155+
" * * ",
156+
" * ",
157+
" * * ",
158+
"* *" ],
159+
160+
"Y" : [ "* *",
161+
"* *",
162+
" * * ",
163+
" * ",
164+
" * " ],
165+
166+
"Z" : [ "*****",
167+
" * ",
168+
" * ",
169+
" * ",
170+
"*****" ]
171+
172+
}
173+
174+
175+
for row in range(5):
176+
for char in text:
177+
printedtext[row] += (str(characters[char][row]) + " ")
178+
179+
offset = width
180+
while True:
181+
os.system("cls")
182+
for row in range(5):
183+
print(" " * offset + printedtext[row][max(0,offset*-1):width - offset])
184+
offset -=1
185+
186+
if offset <= ((len(text)+2)*6) * -1:
187+
offset = width
188+
time.sleep(0.1)

0 commit comments

Comments
 (0)