473,473 Members | 1,920 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

just a beep

Leo
hi there

i want python to do a beep.

in the docu i found in tkinter the method
bell()
but the script:
import Tkinter
Tkinter.bell()
gives the error:
AttributeError: 'module' object has no attribute 'bell'

so how can i make python beep? (maybe even without the tkinter overhead?)

cheers, leo
Jul 18 '05 #1
6 31790
Leo
hi there

neither print chr(7) nor print "\a" works, when you execute the script
directly under windows. (and executing under emacs doesn't work either.)

it seems that the beep is not generated by python itself but by the
terminal emulation.

so again: is there a more robust and terminal independent way to
generate a beep?

cheers, leo

Nick Welch wrote:
On Tue, Sep 02, 2003 at 10:17:02AM +1000, DG wrote:
print chr(7)

:)

print "\a" # too

:)


Jul 18 '05 #2
"Leo" wrote:
so again: is there a more robust and terminal independent way to
generate a beep?


on windows, use winsound.Beep:
import winsound
help(winsound.Beep)

Help on built-in function Beep:

Beep(...)
Beep(frequency, duration) - a wrapper around the Windows Beep API

The frequency argument specifies frequency, in hertz, of the sound.
This parameter must be in the range 37 through 32,767.
The duration argument specifies the number of milliseconds.
On WinNT and 2000, the platform Beep API is used directly. Else funky
code doing direct port manipulation is used; it's unknown whether that
will work on all systems.

</F>


Jul 18 '05 #3
"Leo" wrote:
i want python to do a beep.

in the docu i found in tkinter the method
bell()
but the script:
import Tkinter
Tkinter.bell()
gives the error:
AttributeError: 'module' object has no attribute 'bell'


you might find it easier to use Python if you spend some time reading
up on functions vs. methods; in the meantime, here's one way to call
the "bell" method in Tkinter:
import Tkinter
Tkinter.Tk().bell()


</F>


Jul 18 '05 #4
On Tue, 02 Sep 2003 13:06:00 +1000, Leo <ha*************@NOSPAM.gmx.net> wrote:
hi there

neither print chr(7) nor print "\a" works, when you execute the script directly under windows. (and executing under emacs doesn't work either.)

it seems that the beep is not generated by python itself but by the terminal emulation.

so again: is there a more robust and terminal independent way to generate a beep?

cheers, leo

Nick Welch wrote:
On Tue, Sep 02, 2003 at 10:17:02AM +1000, DG wrote:
print chr(7)

:)

print "\a" # too

:)

If You attempt to use your script only under windows you should try this:
import Winsound
Winsound.Beep(frequency, duration)

-- best regards
Vladimir Ivanov

Jul 18 '05 #5
Leo
thanks a lot! that's what i want: an platform independend beep!

and indeed i want to read more about functions vs methods! but my quick
browse through the docu did not show me that there is sth in beetween
Tkinter and bell...

cheers, leo
"Fredrik Lundh" <fr*****@pythonware.com> wrote in message
news:ma*********************************@python.or g...
"Leo" wrote:
i want python to do a beep.

in the docu i found in tkinter the method
bell()
but the script:
import Tkinter
Tkinter.bell()
gives the error:
AttributeError: 'module' object has no attribute 'bell'


you might find it easier to use Python if you spend some time reading
up on functions vs. methods; in the meantime, here's one way to call
the "bell" method in Tkinter:
>>> import Tkinter
>>> Tkinter.Tk().bell()


</F>

Jul 18 '05 #6

"Leo" <le********@NOSPAM.isys.com.au> schrieb im Newsbeitrag
news:bj***********@otis.netspace.net.au...
thanks a lot! that's what i want: an platform independend beep!

and indeed i want to read more about functions vs methods! but my quick
browse through the docu did not show me that there is sth in beetween
Tkinter and bell...


Of course it did not! Have you ever used mainloop() or after(..) ?
Kindly
Michael P
Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: #Hai | last post by:
Hi, I want to throw out a series of 'beep..beep..beep' to the speaker. How to do that ? Thanks
8
by: Marcia Gulesian | last post by:
How can I create a beep in javascript (I.E. 5.5 +) ?
1
by: Hai Ly Hoang | last post by:
Hi, I want to make a beep (like MS-DOS beep, not a beep from sound-card). How to do that ? Thanks
2
by: Hai Ly Hoang | last post by:
Hi, I want to make a beep from PC speaker (like C++ beep(), not a beep from sound-card). How to do that ? Thanks
3
by: Thom Little | last post by:
The following code will produce a sound in C# ... using System.Runtime.InteropServices; Beep( 500, 500 ); private static extern bool Beep( int freq, int dur ); How can I play the sound...
4
by: Kartic | last post by:
Hi, My program needs to open another form(Form2) at form1 load. But Form2 always opens with a beep. How do I get rid of that beep. I tried to load form2 from Form1 activate also but with no...
4
by: Rich | last post by:
Hello, I want to use the Beep() to alert users about certain messages but in my workstation I can't get a sound out of it. But Beep works in VB6. What do I need to do? Sub... .... Beep()...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
When I press the Enter key in a Textbox I get a beep sound. But when I press the Enter key in a combobox, I don't get the beep sound. Is there a way to suppress the beep? How to do this? ...
2
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
I have a tabcontrol where I want to capture the CTRL+C key combination. My tabcontrol has on its tabpages some treeView controls. My intention is to intercept the event of pressing the CTRL+C when...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.