Python Forum

Full Version: I'm looking for some help with winsound
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok, so my code works. Running it in idle works fine and it plays the sound however when I try to run the program in the regular python console I hear the little windows error noise. Here is my code
def main():
        print("Hello")
        Omniscence = input("how is it going")
        print(Omniscence + ",Ok")
        print("let me ask you a question...")
        Answer = input("would you rather fight 100 chicken sized horses or 10 horse sized chicken")
        Name = input("hey, so what's your name anyway")
        print("so" + Name )
        Color = input("what's your favorite color ")
        if Color == "red":
            print("Red, really... I don't really like that one")
        if Color == "blue":
            print("Oh, okay not my favorite but its okay.")
        if Color == "pink":
            print("What!!!!, I hate pink")
            import winsound
            winsound.PlaySound('Game Laugh Sound.wav', winsound.SND_FILENAME)
        else:
            print("Game Over")
            print("Shutting")
            print("Down")
            print("Really")
            print("you failed")
            print(" ")
            print(" ")
            print(" ")
            print(" ")
while True:
    main()
    if input("Repeat the program? (Y/N)").strip().upper() != 'Y':
        break
Would appreciate the help. Thx Big Grin

Btw this is a script I made to freak out my friend.