I have 2 class Emoji and EmojiRun. I want to call Emoji class function through EmojiRun, using a infinite loop
class Emoji:
def __init__(self):
self.green = (0, 255, 0)
self.yellow = (255, 255, 0)
self.blue = (0, 0, 255)
self.red = (255, 0, 0)
self.white = (255, 255, 255)
self.nothing = (0, 0, 0)
self.brown = (165, 42, 42)
def face(self):
return face
def smile(self):
return smile
def sad(self):
return sad
In my EmojiRun class, I need to call function face, smile, sad.
I can call it individually, but I want to know if there is an way of iterate through Class Emoji's function, like the example below, I know its wrong
#Main class to run Emoji
from animatedEmoji import Emoji
from sense_hat import SenseHat
from time import sleep
#Class instance emoji
emoji = Emoji()
sense = SenseHat()
while True:
#Forloop to call emoji functions 1 by 1
for x in Emoji:
sense.set_pixels(emoji.function[x])
sleep(3)