How to use show_image method in tempest

Best Python code snippet using tempest_python

getting_started.part1_simple_output.py

Source:getting_started.part1_simple_output.py Github

copy

Full Screen

...12from spike.control import wait_for_seconds13# Initialize the Hub14your_hub = PrimeHub()15# Light up a smiley face16your_hub.light_matrix.show_image('HEART_SMALL')17wait_for_seconds(1)18your_hub.light_matrix.show_image('HAPPY')19wait_for_seconds(1)20your_hub.light_matrix.show_image('SMILE')21wait_for_seconds(1)22your_hub.light_matrix.show_image('SAD')23wait_for_seconds(1)24your_hub.light_matrix.show_image('CONFUSED')25wait_for_seconds(1)26your_hub.light_matrix.show_image('ANGRY')27wait_for_seconds(1)28your_hub.light_matrix.show_image('ASLEEP')29wait_for_seconds(1)30your_hub.light_matrix.show_image('SURPRISED')31wait_for_seconds(1)32your_hub.light_matrix.show_image('SILLY')33wait_for_seconds(1)34your_hub.light_matrix.show_image('FABULOUS')35wait_for_seconds(1)36your_hub.light_matrix.show_image('MEH')37wait_for_seconds(1)38your_hub.light_matrix.show_image('YES')39wait_for_seconds(1)40your_hub.light_matrix.show_image('NO')41wait_for_seconds(1)42your_hub.light_matrix.show_image('CLOCK12')43wait_for_seconds(1)44your_hub.light_matrix.show_image('CLOCK1')45wait_for_seconds(1)46your_hub.light_matrix.show_image('CLOCK2')47wait_for_seconds(1)48your_hub.light_matrix.show_image('CLOCK3')49wait_for_seconds(1)50your_hub.light_matrix.show_image('CLOCK4')51wait_for_seconds(1)52your_hub.light_matrix.show_image('CLOCK5')53wait_for_seconds(1)54your_hub.light_matrix.show_image('CLOCK6')55wait_for_seconds(1)56your_hub.light_matrix.show_image('CLOCK7')57wait_for_seconds(1)58your_hub.light_matrix.show_image('CLOCK8')59wait_for_seconds(1)60your_hub.light_matrix.show_image('CLOCK9')61wait_for_seconds(1)62your_hub.light_matrix.show_image('CLOCK10')63wait_for_seconds(1)64your_hub.light_matrix.show_image('CLOCK11')65wait_for_seconds(1)66your_hub.light_matrix.show_image('ARROW_N')67wait_for_seconds(1)68your_hub.light_matrix.show_image('ARROW_NE')69wait_for_seconds(1)70your_hub.light_matrix.show_image('ARROW_E')71wait_for_seconds(1)72your_hub.light_matrix.show_image('ARROW_SE')73wait_for_seconds(1)74your_hub.light_matrix.show_image('ARROW_S')75wait_for_seconds(1)76your_hub.light_matrix.show_image('ARROW_SW')77wait_for_seconds(1)78your_hub.light_matrix.show_image('ARROW_W')79wait_for_seconds(1)80your_hub.light_matrix.show_image('ARROW_NW')81wait_for_seconds(1)82your_hub.light_matrix.show_image('GO_RIGHT')83wait_for_seconds(1)84your_hub.light_matrix.show_image('GO_LEFT')85wait_for_seconds(1)86your_hub.light_matrix.show_image('GO_UP')87wait_for_seconds(1)88your_hub.light_matrix.show_image('GO_DOWN')89wait_for_seconds(1)90your_hub.light_matrix.show_image('TRIANGLE')91wait_for_seconds(1)92your_hub.light_matrix.show_image('TRIANGLE_LEFT')93wait_for_seconds(1)94your_hub.light_matrix.show_image('CHESSBOARD')95wait_for_seconds(1)96your_hub.light_matrix.show_image('DIAMOND')97wait_for_seconds(1)98your_hub.light_matrix.show_image('DIAMOND_SMALL')99wait_for_seconds(1)100your_hub.light_matrix.show_image('SQUARE')101wait_for_seconds(1)102your_hub.light_matrix.show_image('SQUARE_SMALL')103wait_for_seconds(1)104your_hub.light_matrix.show_image('RABBIT')105wait_for_seconds(1)106your_hub.light_matrix.show_image('COW')107wait_for_seconds(1)108your_hub.light_matrix.show_image('MUSIC_CROTCHET')109wait_for_seconds(1)110your_hub.light_matrix.show_image('MUSIC_QUAVER')111wait_for_seconds(1)112your_hub.light_matrix.show_image('MUSIC_QUAVERS')113wait_for_seconds(1)114your_hub.light_matrix.show_image('PITCHFORK')115wait_for_seconds(1)116your_hub.light_matrix.show_image('XMAS')117wait_for_seconds(1)118your_hub.light_matrix.show_image('PACMAN')119wait_for_seconds(1)120your_hub.light_matrix.show_image('TARGET')121wait_for_seconds(1)122your_hub.light_matrix.show_image('TSHIRT')123wait_for_seconds(1)124your_hub.light_matrix.show_image('ROLLERSKATE')125wait_for_seconds(1)126your_hub.light_matrix.show_image('DUCK')127wait_for_seconds(1)128your_hub.light_matrix.show_image('HOUSE')129wait_for_seconds(1)130your_hub.light_matrix.show_image('TORTOISE')131wait_for_seconds(1)132your_hub.light_matrix.show_image('BUTTERFLY')133wait_for_seconds(1)134your_hub.light_matrix.show_image('STICKFIGURE')135wait_for_seconds(1)136your_hub.light_matrix.show_image('GHOST')137wait_for_seconds(1)138your_hub.light_matrix.show_image('SWORD')139wait_for_seconds(1)140your_hub.light_matrix.show_image('GIRAFFE')141wait_for_seconds(1)142your_hub.light_matrix.show_image('SKULL')143wait_for_seconds(1)144your_hub.light_matrix.show_image('UMBRELLA')145wait_for_seconds(1)146your_hub.light_matrix.show_image('SNAKE')147wait_for_seconds(1)148your_hub.light_matrix.show_image('ALL_CLOCKS')149wait_for_seconds(1)150your_hub.light_matrix.show_image('ALL_ARROWS')151wait_for_seconds(1)152your_hub.light_matrix.off()153'''Change the image that’s displayed on the Light Matrix.154Change the parameter "HAPPY" to "HEART" in the code you already have. This will light up the heart instead of the happy face on the Hub.155Or, copy the code from the box below and paste it after the last line of your program. This will light up the happy face for 5 seconds and then light up a heart for 5 seconds.'''156'''157# Add another image158your_hub.light_matrix.show_image('HEART')159wait_for_seconds(5)160your_hub.light_matrix.off()161'''162'''163Playing Short Beeps and Time164Let’s make the Hub play some beeps.165If there's already a program on your Programming Canvas, it’s a good idea to delete it or start a new project before continuing.166Copy the code shown below to the Programming Canvas.167Make sure that you only have one line of code that starts with: from spike import.168Play the program!'''169''''# Import the PrimeHub class170from spike import PrimeHub171from spike.control import wait_for_seconds172# Initialize the Hub...

Full Screen

Full Screen

main.py

Source:main.py Github

copy

Full Screen

...9def on_start_callback():10 global rage, t11 rage = 012 t = 0.0213 codey.display.show_image('00000808080800000000080808080000')14 time.sleep(1)15 codey.display.show_image('00001018181000000000101818100000')16 time.sleep(1)17 codey.display.show_image('00000808080800000000080808080000')18 time.sleep(0.5)19 codey.display.show_image('00001018181000000000101818100000')20 time.sleep(float(t))21 codey.display.show_image('0000181c1c1800000000181c1c180000')22 time.sleep(float(t))23 codey.display.show_image('0000181c1c1800000000181c1c180000')24 time.sleep(float(t))25 codey.display.show_image('0000183c3c1800000000183c3c180000')26 time.sleep(float(t))27 codey.display.show_image('00001c3e3e1c000000001c3e3e1c0000')28 time.sleep(float(t))29 while True:30 codey.display.show_image('00003c7e7e3c000000003c7e7e3c0000')31 for count in range(int(random.randint(200, 600))):32 time.sleep(0.01)33 codey.display.show_image('0000181c1c1800000000181c1c180000')34 for count2 in range(int(random.randint(0, 5))):35 time.sleep(0.01)36 codey.display.show_image('00000808080800000000080808080000')37 for count3 in range(int(random.randint(10, 30))):38 time.sleep(0.01)39 codey.display.show_image('0000183c3c1800000000183c3c180000')40 for count4 in range(int(random.randint(0, 5))):41 time.sleep(0.01)42@event.button_a_pressed43def on_button_callback():44 global rage, t45 if rage > random.randint(3, 5):46 rage = 047 time.sleep(0.5)48 codey.display.show_image('00003c1e0e0400000000040e1e3c0000')49 rocky.backward(20, 0.4)50 rocky.backward(100, 0.01)51 rocky.forward(100, 0.2)52 rocky.backward(100, 0.01)53 time.sleep(0.1)54 codey.speaker.play_melody('angry.wav')55 time.sleep(0.5)56 codey.display.show_image('00003c7e7e3c000000003c7e7e3c0000')57 else:58 time.sleep(0.4)59 codey.display.show_image('000c18181c0c000000000c1c18180c00')60 codey.speaker.play_melody('laugh.wav')61 rocky.turn_left(70, 0.05)62 codey.display.show_image('00183030381800000000183830301800')63 rocky.turn_right(70, 0.05)64 codey.display.show_image('000c18181c0c000000000c1c18180c00')65 rocky.turn_left(70, 0.05)66 rocky.turn_right(70, 0.05)67 time.sleep(0.3)68 codey.display.show_image('00183030381800000000183830301800')69 time.sleep(0.1)70 codey.display.show_image('00003c7e7e3c000000003c7e7e3c0000')71 rage = (rage if isinstance(rage, int) or isinstance(rage, float) else 0) + 172@event.button_b_pressed73def on_button1_callback():74 global rage, t75 if rage > random.randint(3, 5):76 rage = 077 time.sleep(0.5)78 codey.display.show_image('00003c1e0e0400000000040e1e3c0000')79 rocky.backward(20, 0.4)80 rocky.backward(100, 0.01)81 rocky.forward(100, 0.2)82 rocky.backward(100, 0.01)83 time.sleep(0.1)84 codey.speaker.play_melody('angry.wav')85 time.sleep(0.5)86 codey.display.show_image('00003c7e7e3c000000003c7e7e3c0000')87 else:88 time.sleep(0.4)89 codey.display.show_image('000c18181c0c000000000c1c18180c00')90 codey.speaker.play_melody('laugh.wav')91 rocky.turn_right(70, 0.05)92 codey.display.show_image('00183030381800000000183830301800')93 rocky.turn_left(70, 0.05)94 codey.display.show_image('000c18181c0c000000000c1c18180c00')95 rocky.turn_right(70, 0.05)96 rocky.turn_left(70, 0.05)97 time.sleep(0.3)98 codey.display.show_image('00183030381800000000183830301800')99 time.sleep(0.1)100 codey.display.show_image('00003c7e7e3c000000003c7e7e3c0000')101 rage = (rage if isinstance(rage, int) or isinstance(rage, float) else 0) + 1102@event.button_c_pressed103def on_button2_callback():104 global rage, t105 if rage > random.randint(3, 5):106 rage = 0107 time.sleep(0.5)108 codey.display.show_image('00003c1e0e0400000000040e1e3c0000')109 rocky.backward(20, 0.4)110 rocky.backward(100, 0.01)111 rocky.forward(100, 0.2)112 rocky.backward(100, 0.01)113 time.sleep(0.1)114 codey.speaker.play_melody('angry.wav')115 time.sleep(0.5)116 codey.display.show_image('00003c7e7e3c000000003c7e7e3c0000')117 else:118 time.sleep(0.5)119 codey.display.show_image('00081c3c3c3820000020383c3c1c0800')120 time.sleep(0.5)121 codey.speaker.play_melody('sad.wav')122 codey.display.show_image('00040e1e1e1c100000101c1e1e0e0400')123 rocky.backward(50, 0.1)124 codey.display.show_image('00081c3c3c3820000020383c3c1c0800')125 time.sleep(0.3)126 codey.display.show_image('00183c3c7c7820000020787c3c3c1800')127 time.sleep(0.1)128 codey.display.show_image('00003c7e7e3c000000003c7e7e3c0000')...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful