Added play_random function.
This commit is contained in:
parent
1a724ada21
commit
4e6b6ded7c
@ -11,6 +11,7 @@ from xdg import BaseDirectory
|
||||
import pygame
|
||||
import pyperclip
|
||||
import random
|
||||
import re
|
||||
import requests
|
||||
import speechd
|
||||
import subprocess
|
||||
@ -73,6 +74,13 @@ def initialize_gui(gameTitle):
|
||||
time.sleep(soundData['game-intro'].get_length())
|
||||
return soundData
|
||||
|
||||
def play_random(soundName):
|
||||
key = []
|
||||
for i in sounds.keys():
|
||||
if re.match("^" + soundName + ".*", i):
|
||||
key.append(i)
|
||||
psounds[random.choice(key)].play()
|
||||
|
||||
def instructions():
|
||||
# Read in the instructions file
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user