why no sound?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

why no sound?

luofeiyu
here is the code

from Tkinter import *

class Alarm(Frame):
    def __init__(self):             
        Frame.__init__(self)
        self.bell()                 

if __name__ == '__main__':
    Alarm().mainloop()

there is no sound when it run ,why?

_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss
Reply | Threaded
Open this post in threaded view
|

Re: why no sound?

Michael O'Donnell
Hi,

  You should always reduce your example code to the bare minimum
needed to demonstrate the problem.
(often you see the problem yourself  in doing that)

Your code reduces to:

from Tkinter import Frame
Frame().bell()

Does that work on your machine?
If not, check your speakers are turned on and plugged in.

Otherwise, what platform are you on?

It works for me under python 2.7.1 on Windows 7,
I get the bell sound.

Mick





2011/8/23 守株待兔 <[hidden email]>:

> here is the code
>
> from Tkinter import *
>
> class Alarm(Frame):
>     def __init__(self):
>         Frame.__init__(self)
>         self.bell()
>
> if __name__ == '__main__':
>     Alarm().mainloop()
>
> there is no sound when it run ,why?
>
> _______________________________________________
> Tkinter-discuss mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>
>
_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss
Reply | Threaded
Open this post in threaded view
|

Re: why no sound?

Kevin Buchs-2
I'm on Ubuntu Natty, with Python 2.7.1 and it doesn't work for me.

On Tue, Aug 23, 2011 at 5:42 AM, Michael O'Donnell <[hidden email]> wrote:
from Tkinter import Frame
Frame().bell()

_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss
Reply | Threaded
Open this post in threaded view
|

Re: why no sound?

Michael O'Donnell
In a linux terminal, try:

xset b on

Then try the tkinter coder again.

May or may not work, don't have linux here to test it.

mick

On Tue, Aug 23, 2011 at 2:26 PM, Kevin Buchs <[hidden email]> wrote:
> I'm on Ubuntu Natty, with Python 2.7.1 and it doesn't work for me.
>
> On Tue, Aug 23, 2011 at 5:42 AM, Michael O'Donnell <[hidden email]>
> wrote:
>>
>> from Tkinter import Frame
>> Frame().bell()
_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss
Reply | Threaded
Open this post in threaded view
|

Re: why no sound?

Michael Lange
Thus spoketh "Michael O'Donnell" <[hidden email]>
unto us on Tue, 23 Aug 2011 14:49:24 +0200:

> In a linux terminal, try:
>
> xset b on
>
> Then try the tkinter coder again.
>
> May or may not work, don't have linux here to test it.
>
> mick

It works here (debian squeeze).

I am not sure if the OP is aware of the fact that the "bell" sound is
supposed to come out of the PC speaker, not the sound card. So if there
is no PC speaker or it is turned off you will not hear a thing.

I don't know about windows, on unix systems you could also try a more
generic PC speaker test than Frame.bell() with

>>> print '\a'

>>>

from the python prompt or even

 echo -e "\a"

from a standard shell.

Regards

Michael


.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

Is not that the nature of men and women -- that the pleasure is in the
learning of each other?
                -- Natira, the High Priestess of Yonada, "For the World is
                   Hollow and I Have Touched the Sky", stardate 5476.3.
_______________________________________________
Tkinter-discuss mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/tkinter-discuss