pygame learning
This weekend I work with my kid for a science-music project and here are some code for it.
I choose pygame because I want to learn to use class object in my other learning project, I think this project is good for me to try thinking objects.
I am a rookie in coding, codes looks stupid and because I tried to grab codes from lot's of other masters, the code style maybe confused, and I'm sorry for that.
start an pygame project
KEY event listening
show text in pygame
move an object
remove an object
use Tk for loading file
replace Tk with pygame-pgu because Mac won't let me to open
another window
learn more about Class-Object
I actually start this program with winsound module, and it did works. Through winsound I showed my kid the connection in frequency and sound with the Beep function, so I keep that name used continued.
This program is written in python 3.7 with pygame 1.9.6, but on a Mac or with python 3.8 you have to choose install the beta version of pygame (2.0) or it will not work.
I am study coding from home by myself, so if anyone think any idea which could make my code looks better, you're my teacher!
If you want to run this program you will need the Piano sound .WAV files, which should be found at https://github.com/saransha/EasyElectric
you have to download them and put to './Piano' director first.
for soundMac.V0.2.py, add function: save and load.
- '(backslash)' to record and stop,
- 'backspace' to playback.
Now, you can use
- ']' to save record to a file, and use
- '[' to load them back.