New Media Support for CPython
Updated 22 June 2006
From Nadeem Abdul Hamid
I've been looking at using the CPython version of your media computation library (http://coweb.cc.gatech.edu/mediaComp-plan/117) in an introductory CS course at my college. As a result of that, I've made several enhancements and bugfixes to the file that's available at your web page, which are documented in the comments at the top of the file attached to this email. I just thought I'd send you a copy in case you wanted to post this version also on your web page. I'm also including a copy of a graphics library developed by John Zelle because his code provides a couple of functions that wrap around Tkinter and make it run in a separate thread so that it doesn't interfere when used with the IDLE development environment. I've found that the result is pretty robust on both Windows and Macs. My version of the mymedia.py library depends on this graphics.py in addition to the other packages listed at http://coweb.cc.gatech.edu/mediaComp-plan/117 (e.g. PIL, pygame, numpy, etc.)
HOW TO USE THIS
- Install using one of the installers below.
- Start up Python by typing "pythonw" at the command line prompt (Terminal for Macs)
- Type from media import * in Python
- Now, things like p=makePicture(pickAFile()) will work just fine!
Deatailed installation instructions:
There are two different installers one for OS X 10.3 Panther and one for OS X 10.4 Tiger. Make sure you get thr right one, downloading and installing the incorrect installer is a bad thing and can cause some serious problems as the Panther installer adds some packages that Tiger comes pre-bundled with. The result is that these standard packages would get overwritten and the new ones do not work correctly with Tiger yet. Eventually we hope to include these in the Tiger install as well as they are more stable distributions in general, but until they work with Tiger this transition cannot be completed.
Keep in mind that we are developing an installation package using DisUtils, which will be added to the website very soon. Once that is added you will not have to manually install any of these packages except for Python.
self-extracting zip file. Open it and run the four installers.
(old install method: useful if above methods do not work)
Windows: If you get the Enthought Python at http://www.enthought.com/python/, then just install pyGame at ftp://pygame.org/pub/pygame/pygame-1.6.win32-py2.3.exe, you can download media.py then start Python and type from media import *. And it works! (See screenshot at bottom.)
If using python.org python, you will need to install PyGame, PIL, and Numeric, then media.py.
Linux light weight RPM package:(media.py-1.0-1.src.rpm)
Put the media.py file somewhere in the Python search path and in test files place the line: 'from media import * ' you can also simply type 'import media' but this means you have to call all Objects and functions by prefixing media to them 'media.makePicture(filename)' for example.
Because we know there will be bugs and probably a whole bunch of them you can submit bugs to email@example.com. Please give us a the offending code and the error or problem encountered.
Note: One of the requirements we have for this implementation is that to the user the change is transparent as far as functionaity is concerned. So if a function works but works differently than it did in the past this counts as an error so go ahead and submit it.
- The movie viewer does not work at all so calling it would be bad
- The addFilledArc function works kind of but it fills things in wrong so this needs to be modified
- 10/31/05 9:30 PM upload initial version 0.0
- 12/7/05 new version 1.1
- fixed (mostly) the windowing problem by using tkinter rather than wx. There are still a couple of issues that come up but these are dwindling. Now the two large issues are with the color picker not poping up on it's own you have to click around a bit first on the python icon in the taskbar and then back on the prompt window before it will show up. Also the file/folder dialog if used sticks around and can pop-up as a non-responsive window.
- version global function returns a version
- the import is going to take a bit longer now because all the init code has been placed here rather than in the class init methods
- PIL is now required by the media.py package as is Tkinter. Tkinter should come as a standard part of any Python install PIL probably will have to be added. You can check for PIL in your system by trying to import its main module 'Image'
- 12/12/05 Version 1.2
- no major changes mostly just cleaning up some code added the detection to repaint and show so they will react properly if you repaint unopened window or show one already shown (and still visible)
The package should open almost any .wav file, but all files will be
converted to a 22050Hz 16bit sound in memory for use in media.py
Therefor, any files you save will be in that format, as well as
the return value for the getLength() function.
There are no known issues at this time.
for Sound Object:
for Samples Object:
for Sample Object:
Global functions from medai.py:
Team 7 Design.pdf
test plan v2.pdf
Link to this Page
- Mediacomp Software last edited on 25 January 2007 at 11:41 am by c-69-180-25-97.hsd1.ga.comcast.net