From f22cd5a191071cf06076da940fcbf61355f8bc97 Mon Sep 17 00:00:00 2001 From: chrys Date: Sun, 20 Mar 2016 23:37:39 +0100 Subject: [PATCH] create dict with filenames --- pybottle/storm_games.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pybottle/storm_games.py b/pybottle/storm_games.py index a7c1c33..531f819 100755 --- a/pybottle/storm_games.py +++ b/pybottle/storm_games.py @@ -8,13 +8,16 @@ from os.path import isfile, join import pygame import time +SoundFolder = 'sounds' + def initialize_gui(gameTitle): # start pygame pygame.init() # start the display (required by the event loop) pygame.display.set_mode((320, 200)) pygame.display.set_caption(gameTitle) - # Load sounds from the sound directory - onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))] + # Load sounds from the sound directory and creates a dict like that {'bottle': 'bottle.ogg'} + soundFiles = {f.split('.')[0]:f for f in listdir(SoundFolder) if isfile(join(SoundFolder, f))} +