title: Play winsound at a specific condition
body: <p>I am working on Tkinter to animate a diver jumps into the water.
  I need the program plays a sound the moment he touches the water.
  Here is <strong>part</strong> of my code but it didn't work.</p>
  
  <pre><code>    from tkinter import *
      from tkinter import ttk
      from math import *
      import winsound, sys
      def beep():
          winsound.PlaySound('death1.wav' , winsound.SND_FILENAME)
  
      def animate():            
          nonlocal x,y,flag,t,i
          t=i*dt
          i=i+1
          if y&lt;=PosYe+20:     #we define the water level = PosYe+20
              Canevas.coords(plongeur,x,y)
              x,y=x,y+g*t*dt*m1  
              if y==PosYe+20 :
                  beep()
  </code></pre>
  
  <p>I tried this (just to verify if it can play the sound), it plays the sound everytime it calculates it's new position. So i wonder if i can't write a condition in a condition in this situation.</p>
  
  <pre><code>    from tkinter import *
      from tkinter import ttk
      from math import *
      import winsound, sys
      def beep():
          winsound.PlaySound('death1.wav' , winsound.SND_FILENAME)
  
      def animate():            
          nonlocal x,y,flag,t,i
          t=i*dt
          i=i+1
          if y&lt;=PosYe+20:     #we define the water level = PosYe+20
              Canevas.coords(plongeur,x,y)
              x,y=x,y+g*t*dt*m1  
              beep()
  </code></pre>
  
  <p>I need some advice to write the condition correctly.</p>