Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #26017

Re: howto do a robust simple cross platform beep

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.025
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'python': 0.09; 'friday,': 0.09; 'git': 0.09; 'subject:howto': 0.09; 'gui': 0.11; 'alert,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'inclined': 0.16; 'reasonable.': 0.16; 'subject:simple': 0.16; 'ways:': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'basically': 0.17; 'certainly': 0.17; '>>>': 0.18; 'platforms': 0.18; 'module': 0.19; 'written': 0.20; 'received:209.85.214.174': 0.21; "i'd": 0.22; 'non': 0.24; 'command': 0.24; 'script': 0.24; 'header:In-Reply- To:1': 0.25; 'creating': 0.26; 'am,': 0.27; '(as': 0.27; 'easiest': 0.27; 'message-id:@mail.gmail.com': 0.27; 'options': 0.27; "doesn't": 0.28; 'facing': 0.29; 'wrap': 0.29; "i'm": 0.29; 'function': 0.30; '(and': 0.32; 'file': 0.32; 'running': 0.32; 'could': 0.32; 'certain': 0.33; 'to:addr:python-list': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'done': 0.34; 'platforms,': 0.35; 'problem,': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'add': 0.36; 'but': 0.36; 'too': 0.36; 'quite': 0.37; 'rather': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'behind': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'easily': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'help': 0.40; 'your': 0.60; 'july': 0.60; 'telling': 0.61; 'solve': 0.62; 'different': 0.63; 'email addr:gmail.com': 0.63; 'more': 0.63; 'within': 0.64; 'results': 0.65; 'jul': 0.65; 'hours': 0.66; 'sounds': 0.71; '2-3': 0.75; 'complexity': 0.84; 'gelonida': 0.84; 'checks.': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=LCAOmN13KAS8zv+uhy040NqScRML1pwZv49JFLkSj8I=; b=S5KkmEPOxK0wyPoI7+alXbLvU1j8LZMcwxF/MDxHokMRVaGxBr+fQys2r795JE+Ujw I+0DrKz5f5CvfTcBi6VqChD0t0JM/NdhZ90e4LlfCt86brSQI7PPT0sHcDeLO0hAlCka Y8/LjMj5dn0vP1A8CA8MCkPibisW3wgpFSqD90vfARqiFoOCT6q4wS69RjF0VV9+L+e6 takVymEskaepsE/GRRRiCHbGzQ968ALJcchHQCj3VmvU8tBHHdWOt+Wsa9hopjJxBwhR sjCEXNQ3wiXR7lsUrHXRpos3PWXaoxoXf7DENqMaurUXFDx66GjWYv+vBhzH55RIOhpA EfNw==
MIME-Version 1.0
In-Reply-To <jun4mi$fvh$1@dough.gmane.org>
References <mailman.2110.1342227619.4697.python-list@python.org> <4ed2a36d-a034-45d8-84f7-aa71ff17d8b5@googlegroups.com> <jun4mi$fvh$1@dough.gmane.org>
Date Wed, 25 Jul 2012 07:52:27 +1000
Subject Re: howto do a robust simple cross platform beep
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2556.1343166755.4697.python-list@python.org> (permalink)
Lines 35
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1343166755 news.xs4all.nl 6895 [2001:888:2000:d::a6]:55107
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26017

Show key headers only | View raw


On Wed, Jul 25, 2012 at 7:39 AM, Gelonida N <gelonida@gmail.com> wrote:
> On 07/15/2012 03:15 AM, rantingrickjohnson@gmail.com wrote:> On Friday, July
> 13, 2012 8:00:05 PM UTC-5, gelonida wrote:
>>> I just want to use a beep command that works cross platform. [...] I
>>> just want to use them as alert, when certain events occur within a
>>> very long running non GUI application.
>>
>> I can see a need for this when facing a non GUI interface.
> That's exactly my usecase.
> A rather tiny script running for hours and telling the users when results
> are ready.

Sounds reasonable. I'd be inclined to solve just my own problem,
though; work it out for the platforms you use, and don't worry too
much about the rest. But that's because I'm lazy :)

> Could I use github (as O know git already)?

You certainly could, though that doesn't help with the whole "building
a module" part. (And I can't help there either, never done it. Sorry.)

There are quite a few ways of creating an alert such as you describe.
The easiest way may be to play a .WAV file rather than a system beep;
there are a number of different options on different platforms, so
your module could be written in pure Python and basically wrap the
whole lot up into a huge bunch of "except ImportError" checks. Here's
a few ways:

http://stackoverflow.com/questions/307305/play-a-sound-with-python

Burying all that complexity behind a simple "play_sound()" function
would be handy, and you could easily start with just 2-3 options and
add more later.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

howto do a robust simple  cross platform  beep Gelonida N <gelonida@gmail.com> - 2012-07-14 03:00 +0200
  Re: howto do a robust simple  cross platform  beep Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-14 03:19 +0000
    Re: howto do a robust simple  cross platform  beep Dieter Maurer <dieter@handshake.de> - 2012-07-14 19:54 +0200
    Re: howto do a robust simple cross platform beep Chris Angelico <rosuav@gmail.com> - 2012-07-15 04:49 +1000
      Re: howto do a robust simple cross platform beep Hans Mulder <hansmu@xs4all.nl> - 2012-07-15 02:39 +0200
        Re: howto do a robust simple cross platform beep Chris Angelico <rosuav@gmail.com> - 2012-07-15 11:07 +1000
  Re: howto do a robust simple  cross platform  beep Miki Tebeka <miki.tebeka@gmail.com> - 2012-07-14 11:43 -0700
  Re: howto do a robust simple  cross platform  beep Miki Tebeka <miki.tebeka@gmail.com> - 2012-07-14 11:43 -0700
  Re: howto do a robust simple  cross platform  beep rantingrickjohnson@gmail.com - 2012-07-14 18:15 -0700
    Re: howto do a robust simple  cross platform  beep Gelonida N <gelonida@gmail.com> - 2012-07-24 23:39 +0200
    Re: howto do a robust simple cross platform beep Chris Angelico <rosuav@gmail.com> - 2012-07-25 07:52 +1000
  Re: howto do a robust simple  cross platform  beep rantingrickjohnson@gmail.com - 2012-07-14 18:15 -0700

csiph-web