Hi, Im starting to learn Python, and downloaded Net Beans as an IDE. Would you recomend me please a tutorial for a begining with this two integrated enviroments?
Thank you very much. On Thu, Jun 13, 2013 at 3:21 PM, <tutor-requ...@python.org> wrote: > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body 'help' to > tutor-requ...@python.org > > You can reach the person managing the list at > tutor-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Tutor digest..." > > > Today's Topics: > > 1. Re: sound implementation problems (Dave Angel) > 2. Re: sound implementation problems (Jim Mooney) > 3. Re: sound implementation problems (Francois Dion) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 13 Jun 2013 13:55:32 -0400 > From: Dave Angel <da...@davea.name> > To: tutor@python.org > Subject: Re: [Tutor] sound implementation problems > Message-ID: <51ba0794.40...@davea.name> > Content-Type: text/plain; charset=ISO-8859-1; format=flowed > > On 06/13/2013 01:21 PM, jessica peters wrote: > > Hi > > > > I'm about 2 yrs into studying Python - started with "Hello World", and > I'm working with v 2.5.1 right now. The past year I've begun trying to > write my own interactive fiction. That works pretty well, but now I'm > attempting to put some music into programs (I thought background music > would be good), and I'm running into roadblocks. > > > > I've tried several different things for this, and come up with either my > text that comes to a halt eventually at an error message (can't read from > the files or mixer isn't initialized are the most common ones), or a > completely blank screen with no sound. I've tried both .mp3 files and .wav > ones, neither works for this. > > > > Here's the most recent code I've attempted: > > > > import pygame , sys > > import random > > size=[500,500] > > def run(self): > > It's not customary to use self as a name in a non-class function. > > > import pygame.mixer > > pygame.mixer.init(22050, -16, 2, 4096) > > self.sound.seek(0) > > What is the object that has this sound attribute? > > > snd = pygame.mixer.Sound(self.sound) > > pygame.mixer.Sound.play("bach-cello-suite-1.wav") > > musicPlaying = True > > > > Nobody calls the function, so this file will silently exit. > > > Any ideas would be appreciated. Thanks. > > > > Somebody familiar with both pygame and with sound might be able to help. > But you really ought to tell them what version of pygame, and what OS > you're running on. > > And if you get an error message, copy/paste the whole thing, don't > paraphrase, and show the same code as what was failing. > > > -- > DaveA > > > ------------------------------ > > Message: 2 > Date: Thu, 13 Jun 2013 10:56:06 -0700 > From: Jim Mooney <cybervigila...@gmail.com> > To: jessica peters <howewriter2...@yahoo.com> > Cc: "Tutor@python.org" <Tutor@python.org> > Subject: Re: [Tutor] sound implementation problems > Message-ID: > <CALRAYNW_= > ycvyjsvoddxu_d48zkdqdsrzjma4oe7xcuhmrv...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > I'll assume you're using Windows. If not, ignore this ;') > > winsound on windows is Python native, much simpler, and always works. After > importing it you can type help(winsound) to see its controls. But here is > the usage for a wav file (it doesn't play mp3s) There is no rule you have > to use the pygame functionality, which is more complex, to get a sound, if > that's all you want. > > import winsound > winsound.PlaySound('c:/python33/media/wtf.wav', 1) > > Make sure you end with the "1". The helpfile doesn't mention what to use as > the second parameter, but 1 works fine. And one other thing that tripped me > up. If you're using an IDE or editor, mine has the unfortunate habit of > loading in its own directory, and having no option to automatically access > files from my program directory. It saves a program into the last used > directory, but looks for sounds in its own directory. Ugh. When I thought > my program was accessing a wav from my standard program directory, it was > really trying to find it in the PyScripter directory ;') > > So use the Full Path to your sound file, and avoid that possible problem. I > have a startup script that now stays in my program directory, though. Of > course, if you have an IDE or editor that lets you set the default > directory that's no problem. > > If your editor doesn't do default directories but has startup scripts this > will work (changing the directoy in chdir to your system, of course) > > import os > os.chdir('c:/python33/jimprogs') > del(os) > > > Jim > > On 13 June 2013 10:21, jessica peters <howewriter2...@yahoo.com> wrote: > > > Hi > > > > I'm about 2 yrs into studying Python - started with "Hello World", and > I'm > > working with v 2.5.1 right now. The past year I've begun trying to write > > my own interactive fiction. That works pretty well, but now I'm > attempting > > to put some music into programs (I thought background music would be > good), > > and I'm running into roadblocks. > > > > I've tried several different things for this, and come up with either my > > text that comes to a halt eventually at an error message (can't read from > > the files or mixer isn't initialized are the most common ones), or a > > completely blank screen with no sound. I've tried both .mp3 files and > .wav > > ones, neither works for this. > > > > Here's the most recent code I've attempted: > > > > import pygame , sys > > import random > > size=[500,500] > > def run(self): > > import pygame.mixer > > pygame.mixer.init(22050, -16, 2, 4096) > > self.sound.seek(0) > > snd = pygame.mixer.Sound(self.sound) > > pygame.mixer.Sound.play("bach-cello-suite-1.wav") > > musicPlaying = True > > > > Any ideas would be appreciated. Thanks. > > > > my website: http://jahowe.com > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > To unsubscribe or change subscription options: > > http://mail.python.org/mailman/listinfo/tutor > > > > > > > -- > Jim > A noun is just a verb with the hiccups > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/tutor/attachments/20130613/df20d7c5/attachment-0001.html > > > > ------------------------------ > > Message: 3 > Date: Thu, 13 Jun 2013 15:21:45 -0400 > From: Francois Dion <francois.d...@gmail.com> > To: jessica peters <howewriter2...@yahoo.com> > Cc: "Tutor@python.org" <Tutor@python.org> > Subject: Re: [Tutor] sound implementation problems > Message-ID: > <CAOLi1KCR1YCtNXfJTr6i+mP5= > gixp4_k4tvrnqzjzgh0gdl...@mail.gmail.com> > Content-Type: text/plain; charset="utf-8" > > I'd start with something simple first, to make sure you have sound output > etc. Run python interactively in the directory you have your wav file. At a > minimum, you need to import pygame, init the mixer (args are not really > needed, but I'll use what you had), set up the sound file and finally, play > it: > > >>> import pygame > >>> pygame.mixer.init(22050,-16,2,4096) > >>> snd = pygame.mixer.Sound("bach-cello-suite-1.wav") > >>> music = snd.play() > > music will start playing in the background. To check if the music is still > playing: > > >>> music.get_busy() > 1 > >>> music.get_busy() > 1 > >>> music.get_busy() > 0 > > And that's that. In your code, your run() function was probably a method > taken out of a class where sound returns a filename and seek(0) seeks to > the beginning of a file. You are missing the rest of the class. But, like I > said, you really only need 4 lines to play a wav file. > > BTW, nice russian ?????????? in the background image of your site. > > Francois > -- > www.pyptug.org - raspberry-python.blogspot.com - @f_dion > > > > On Thu, Jun 13, 2013 at 1:21 PM, jessica peters <howewriter2...@yahoo.com > >wrote: > > > Hi > > > > I'm about 2 yrs into studying Python - started with "Hello World", and > I'm > > working with v 2.5.1 right now. The past year I've begun trying to write > > my own interactive fiction. That works pretty well, but now I'm > attempting > > to put some music into programs (I thought background music would be > good), > > and I'm running into roadblocks. > > > > I've tried several different things for this, and come up with either my > > text that comes to a halt eventually at an error message (can't read from > > the files or mixer isn't initialized are the most common ones), or a > > completely blank screen with no sound. I've tried both .mp3 files and > .wav > > ones, neither works for this. > > > > Here's the most recent code I've attempted: > > > > import pygame , sys > > import random > > size=[500,500] > > def run(self): > > import pygame.mixer > > pygame.mixer.init(22050, -16, 2, 4096) > > self.sound.seek(0) > > snd = pygame.mixer.Sound(self.sound) > > pygame.mixer.Sound.play("bach-cello-suite-1.wav") > > musicPlaying = True > > > > Any ideas would be appreciated. Thanks. > > > > my website: http://jahowe.com > > > > _______________________________________________ > > Tutor maillist - Tutor@python.org > > To unsubscribe or change subscription options: > > http://mail.python.org/mailman/listinfo/tutor > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/tutor/attachments/20130613/d42716e0/attachment.html > > > > ------------------------------ > > Subject: Digest Footer > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > > ------------------------------ > > End of Tutor Digest, Vol 112, Issue 52 > ************************************** >
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor