If you just draw rectangles, you would have to track the mouse cursor and check to see if it's within the boundaries of a rectangle manually. I suggest using buttons. It will be easier to know when the mouse is over them.
> Hello, > > The attached code makes a number of colored rectangles visible > in a canvas. Each rectangle should match with a pre-recorded sound > file (in .wav or other format) containing the pronunciation of a > letter of the alphabet in a given language. For instance, the first > rectangle, in white, should correspond to the sound "a" (let's say, > in Spanish) and it should be heard once the cursor is inside the > rectangle. This can easily be done with the "PlaySound" command of > "winsound". It is less obvious to find the proper binding event that > will both play the sound "a" and show the corresponding sign (or > letter) "a", preferably in a blinking mode, after a short time > interval within the rectangle. > > Can someone suggest a possible solution to this problem? > > Moreover, as the complete set of rectangles should, in > principle, represent all sounds of a given language, it also should > be possible to generate any word in that language by moving the > cursor from one rectangle to the other - just as a teacher would move > a pointer to similar signs if they were shown on a blackboard. For > instance, in order to produce the word "amigo" (if we stick to our > Spanish example) she first would point at the white rectangle, then > at another rectangle (not shown here) corresponding to the sound and > the sign "m", then at a third one for "i", and so on until the whole > word has been formed. > > The word itself (and, in fact, entire sentences) could be > heard after having been pre-recorded in a lexical database. The user > could then be asked to write the letter, word or phrase he/she has > just heard in a text area below the set of rectangles. He/she could > also be asked to repeat the same sounds (letter, word and sentences) > in order to receive a corrected feed-back, provided some voice > recognition and synthesis devices were available. > > The functionalities I am trying to implement for this purpose > (aside from the more traditional ones of resetting, erasing text and > quitting the program) are those that will enable the user to hear a > sound (letter, word or whole sentence), write what he/she has heard > in a text area, repeat it and wait for a corrected answer through a > voice recognition and synthesis process. Can this be done in Python? > > Thank you in advance for any suggestion or answer, even > partial, to my question. > > > > -------------------------------------------------------------------------------- > _______________________________________________ > Tutor maillist - [email protected] > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
