# EG3-04 hello world import snaps snaps.display_message('hello world')
#Program z użyciem biblioteki SNAPS #Wersja 1.1 #Autor: Oskar Tyniec import pygame import snaps import time snaps.display_image("background.jpg") # Funkcja wyświetla tekst w kolorze 0,0,200 o rozmiarze 30 , usytuowany w lewo-horyzontalnie i na środek-vertykalnie snaps.display_message("witaj w prostym programie",color=(255,255,255),size=40,horiz='right',vert='bottom') time.sleep(3) snaps.display_message("DING!") snaps.play_sound("ding.wav") time.sleep(3)
import snaps snaps.display_image('themepark.png') prompt = '''These are the available rides 1: Scenic River Cruise 2: Carnival Carousel 3: Jungle Adventure Water Splash 4: Downhill Mountain Run 5: The Regurgitator Select your ride: ''' ride_number_text = snaps.get_string(prompt, vert='bottom', max_line_length=3) confirm = 'Ride ' + ride_number_text snaps.display_message(confirm)
# EG6-18 Digital Clock import time import snaps while True: current_time = time.localtime() hour_string = str(current_time.tm_hour) minute_string = str(current_time.tm_min) second_string = str(current_time.tm_sec) time_string = hour_string + ':' + minute_string + ':' + second_string snaps.display_message(time_string) time.sleep(1)
import snaps from datetime import datetime from time import sleep snaps.display_image("clock.jpg") while True: time = datetime.now() snaps.display_message(time.strftime("%X"), color=(0, 220, 0), size=210) sleep(1)
if minute_num == 59 and second_num == 57: pygame.mixer.init() if minute_num == 0 and second_num == 0: ding_dong.play() if minute_num == 0 and second_num == 15: sound_var.play(loops=(hour_num-1), fade_ms=120) #Provides sound effects at the top of the hour if minute_num <=9: minute_stng=('0'+str(current_time.tm_min)) else: minute_stng=str(current_time.tm_min) #Puts a zero in front of the minute when the minute is less than ten second_stng=str(second_num) hour_stng=str(hour_num) clock_stng=(hour_stng+ ':' +minute_stng+ ':' +second_stng) snaps.display_message(clock_stng, size=200, color=(0,255,0)) time.sleep(1) #Lines up the string and displays it #waits for a second before returning to the top of the loop else: while True: current_time=time.localtime() hour_num=current_time.tm_hour minute_num=current_time.tm_min second_num=current_time.tm_sec if hour_num > 12: hour_num=hour_num-12 hour_stng=str(hour_num) clock_sector=' PM' else:
import snaps snaps.display_message("hello world", color=(0, 255, 200), size=80, horiz="left", vert="top")
# EG5-12 Snaps get_string function import snaps name = snaps.get_string('Enter your name: ') snaps.display_message('Hello ' + name)
import snaps snaps.display_image("Housemartins.jpg") snaps.display_message("Hull Rocks", color=(255, 255, 255), vert="top")
import snaps snaps.display_image('Housemartins.jpg') snaps.display_message('Hull Rocks', color=(255, 255, 255), vert='top')
import time import pygame import snaps loopinit=True soundinit=True looplength=25 pygame.mixer.init() sound_ob=pygame.mixer.Sound('timer_sound1.wav') sound_ob.play() final_countdown=20# ;) for var_1 in range(0,20): snaps.display_message(str(final_countdown)) final_countdown=final_countdown-1
snaps.setup(width=1350, height=670, title='STEAL THE BACON') sound_ob=pygame.mixer.Sound('A-Tone_mod.wav') snaps.get_key() past_num=[0] counter=0 while True: num_called=(random.randint(1, num_max)) num_str=str(num_called) if counter == 0: past_num[0]=num_called key_code='n' else: past_num.append(num_called) run_check=past_num[counter] == past_num[counter-1] and past_num[counter] == past_num[counter-2] if run_check == True: snaps.display_message('oops') snaps.get_key() continue time.sleep(0.25) sound_ob.play() color_change_r=random.randint(0,255) color_change_g=random.randint(0,255) snaps.display_message('Number\n'+num_str, vert='bottom', horiz='center',size=250,color=(color_change_r,color_change_g,255)) time.sleep(3) snaps.clear_display() counter=counter+1 #add in keydown recognition advance = False while advance == False: event = pygame.event.wait()
bin(1) bin(2) print('The Answer Is:', 2+2) import random print(random.randint(1,77)) print('You are thinking of the number is it?:', random.randint(1,777)) import time print('Think of a Number_<@:D_\nI need time to calculate your guess.\n[Processing]') time.sleep(3) print('You guessed:\n', random.randint(1, 7777777)) time.sleep(5) #py -m pip install pygame --user import snaps time.sleep(1) snaps.display_message('<@:D_Pick a Number Between:\n7 and 77777_<@:D', size=50, color=(255,1,1)) time.sleep(3) snaps.display_message('Need Time to Calculate Your Guess.\n[Processing]', size=60, color=(1,255,1)) time.sleep(3) yourGuess = random.randint(7, 7777777) snaps.display_message('<@:D\nYou Guessed the Number:\n<@:D', size=(70), color=(1,36,86)) time.sleep(3) snaps.display_message(yourGuess) time.sleep(3) snaps.display_message('I <3 MoM') time.sleep(3) snaps.display_message('AK_4-Life', size=127, color=(51,255,255)) time.sleep(3) snaps.display_message('{Niece + Nephew} = _<3_<3_<3_<3_', size=107,) time.sleep(3) snaps.display_message('BackGround Color: White\nForeGround Color: [Powershell Blue]\nAlign Text to the Top Left of Window', color=(1,36,86), size=50, horiz='Left', vert='top')
#Snap a hello world window import snaps snaps.display_message('Hello World')
# EG5-03 Siren Alarm Clock import time import snaps current_time = time.localtime() hour = current_time.tm_hour minute = current_time.tm_min if (hour > 7) or (hour == 7 and minute > 29): snaps.display_message('TIME TO GET UP') snaps.play_sound('siren.wav') # pause the program to give the sound time to play time.sleep(10)
import time import snaps current_time = time.localtime() hour = current_time.tm_hour minute = current_time.tm_min if (hour > 7) or (hour == 7 and minute > 29): snaps.display_message("TIME TO GET UP") snaps.play_sound("alarm.wav") time.sleep(10) print("The time is", hour, ":", minute)
tone = pygame.mixer.Sound('A-Tone.wav') bell = pygame.mixer.Sound('Ship_bell.wav') crash = pygame.mixer.Sound('Crash_Large.wav') while loopy: counter = 0 command_num = random.randint(2, counter_max) while counter <= command_num: command = random.randint(1, 6) pygame.mixer.init() if prev_command == command: continue if command == 1: tone.play(loops=1) snaps.display_message('PORT', color=(0, 0, 255), vert='bottom') if command == 2: tone.play(loops=1) snaps.display_message('BOW', color=(255, 0, 0), vert='bottom') if command == 3: bell.play() snaps.display_message('MAN OVERBOARD', color=(255, 255, 255), vert='bottom') if command == 4: tone.play(loops=1) snaps.display_message('STARBOARD', color=(255, 255, 0), vert='bottom') if command == 5: snaps.display_message('SHIPWRECK',
import snaps snaps.display_message('Anandteerth Onkar')
horiz='left', vert='bottom', cursor='_') time_array = str.split(time_input, ':') i = 0 while i < len(time_array): try: int(time_array[i]) int_check = True i = i + 1 except ValueError: int_check = False if int_check == False: snaps.display_message( "ERROR\nPossible problems:\n Wrong format or Input wasn't an integer\nTry Again", size=40) time.sleep(E_msg_time) i = len(time_array) + 1 if int_check == True: input_validate = False while checker_var: input_validate = True if len(time_array) > 2: length_check = False break if len(time_array) == 1: min_var = 0 sec_var = int(time_array[0])