473,786 Members | 2,398 Online
Bytes | Software Development & Data Engineering Community
+ 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 31823
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.B eep)

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().be ll()


</F>


Jul 18 '05 #4
On Tue, 02 Sep 2003 13:06:00 +1000, Leo <ha************ *@NOSPAM.gmx.ne t> 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(f requency, 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*****@python ware.com> wrote in message
news:ma******** *************** **********@pyth on.org...
"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().be ll()


</F>

Jul 18 '05 #6

"Leo" <le********@NOS PAM.isys.com.au > schrieb im Newsbeitrag
news:bj******** ***@otis.netspa ce.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
3349
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
9128
by: Marcia Gulesian | last post by:
How can I create a beep in javascript (I.E. 5.5 +) ?
1
1927
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
13383
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
2901
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 associated with the System "Default Beep"?
4
3739
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 success. Please advise. Thanks in advance. Kartic
4
6893
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() For i = 0 to 100: Beep(): Next
4
9955
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? Thanks
2
4770
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 one of the controls embedded in the tabControl has the focus. I'm doing this using the KeyDown event. However, when pressing the CTRL+C my computer sounds a beep - as in 'not allowed' beep. The capturing of the keycombination works fine, however,...
0
9496
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9961
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8989
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6745
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.