Discussion:
[Tkinter-discuss] why no sound?
守株待兔
2011-08-23 09:38:39 UTC
Permalink
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20110823/9febde38/attachment.html>
Michael O'Donnell
2011-08-23 10:42:59 UTC
Permalink
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
Post by 守株待兔
here is the code
from Tkinter import *
??????? Frame.__init__(self)
??????? self.bell()
??? Alarm().mainloop()
there is no sound when it run ,why?
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss at python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Kevin Buchs
2011-08-23 12:26:44 UTC
Permalink
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
Post by Michael O'Donnell
from Tkinter import Frame
Frame().bell()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20110823/db619259/attachment.html>
Michael O'Donnell
2011-08-23 12:49:24 UTC
Permalink
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
Post by Kevin Buchs
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 <michael.odonnell at uam.es>
Post by Michael O'Donnell
from Tkinter import Frame
Frame().bell()
Michael Lange
2011-08-24 08:47:58 UTC
Permalink
Thus spoketh "Michael O'Donnell" <michael.odonnell at uam.es>
Post by Michael O'Donnell
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
Post by Michael O'Donnell
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.

Loading...