- emoji
import emoji
import asyncio
import random
from itertools import cycle
def random_emojis(count):
# get the names of the English emoji
d = emoji.unicode_codes.EMOJI_UNICODE_ENGLISH.keys()
# stick count of them together and "emojize"
msg = emoji.emojize(' '.join(random.sample(list(d), count)))
return msg
globe_list = ['globe_showing_Europe-Africa', 'globe_showing_Americas', 'globe_showing_Asia-Australia']
globe_cycle = cycle(globe_list)
for globe in globe_cycle:
msg = emoji.emojize(f"Hello, :{globe}:! Isn't PyScript great :thumbs_up:")
pyscript.write('main', msg)
# so the random 10 do not update too quickly to appreciate...
if globe == globe_list[0]:
rnd = random_emojis(10)
pyscript.write('random', rnd)
await asyncio.sleep(1.4)
Emoji in PyScript
Here is a random selection of ten emojis:
Uses:
Made by @nmstoker