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


Groups > comp.lang.python > #38235

Re: Detecting a click on the turtle screen when the turtle isn't doing anything?

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'true,': 0.04; 'classes.': 0.07; 'main()': 0.07; 'method,': 0.07; 'turtle': 0.07; 'argument,': 0.09; 'globals': 0.09; 'imho.': 0.09; 'terminate.': 0.09; 'threads,': 0.09; ';-)': 0.11; "wouldn't": 0.11; 'java,': 0.15; 'adam': 0.16; 'cleaner': 0.16; 'java.': 0.16; 'loops': 0.16; 'mistake.': 0.16; 'somewhere.': 0.16; 'subject: \n ': 0.16; 'subject:Detecting': 0.16; 'subject:screen': 0.16; 'subject:turtle': 0.16; 'subject:when': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'together.': 0.21; 'class.': 0.23; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'functions.': 0.27; "doesn't": 0.28; 'loop,': 0.29; 'probably': 0.29; 'class': 0.29; "i'm": 0.29; 'becomes': 0.30; 'unlike': 0.30; 'function': 0.30; 'code': 0.31; 'problem.': 0.32; 'to:addr:python-list': 0.33; "can't": 0.34; 'pm,': 0.35; 'subject:?': 0.35; 'but': 0.36; 'should': 0.36; 'being': 0.37; 'passed': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'easier': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'called': 0.39; 'skip:" 10': 0.40; 'received:192.168': 0.40; 'your': 0.60; 'most': 0.61; 'back': 0.62; 'between': 0.63; 'email addr:gmail.com': 0.63; 'become': 0.65; 'received:74.208': 0.71; 'sharing': 0.74; 'coexist': 0.84; 'confusing': 0.84; 'received:74.208.4.194': 0.84; 'subject:anything': 0.84
Date Tue, 05 Feb 2013 16:55:55 -0500
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
MIME-Version 1.0
To python-list@python.org
Subject Re: Detecting a click on the turtle screen when the turtle isn't doing anything?
References <5id7u9x7rd.ln2@news.ducksburg.com> <8e3f3198-3657-4abc-b367-06479a561e41@googlegroups.com> <6s48u9x49o.ln2@news.ducksburg.com>
In-Reply-To <6s48u9x49o.ln2@news.ducksburg.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:lb2kJ2r0P9k7jIskWVSn6NzLqiGETmQf8F85llODWn6 LaWbVBC6ORPxxKezYtn+jL1y1XGpTletFPpamrRHriNMb3OQDg zWl4IkwycPhP2jrssyktbmN8wY5fyeuYdnSz1GTCOYtkJqIGml eF/Mtu+AXZ1D1R3bSs+kAwMydbsSMcXWilmr9Y51iHAq/mr7WZ Et0NLrkKrSuTX0uhoanpdN01tpvbUcxVuGyd2Td1yGWXc35Scw BxcpFLS0UbC/fKpaTb4waGNqPXIJk9P/dBMs0RH24pl4PY8jOp 1k/3Dqv6l9BvPmCz5oh6rbq9D2oZT47Coqp/A/l6uJwPQ0CWA= =
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.1391.1360101376.2939.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1360101376 news.xs4all.nl 6934 [2001:888:2000:d::a6]:44693
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:38235

Show key headers only | View raw


On 02/05/2013 02:58 PM, Adam Funk wrote:
> On 2013-02-05, woooee@gmail.com wrote:
>
>>    <SNIP>
>
>> Globals are
>>   confusing IMHO.  Code becomes cleaner and easier to write and read
>>   when you become familiar with classes.
>
<snip>
>   If I have to write a class just to create
> one instance of it & call the main() method, I might as well use Java!
> ;-)
>

I'm no fan of Java.  But it's not about a "main" method, it's about 
sharing data between functions.  Most of the time non-constant globals 
are a mistake.  If the data can't be passed as an argument, then it 
should probably be part of the instance data of some class.  Which class 
is a design decision, and unlike Java, I wouldn't encourage writing a 
class for unrelated functions, just to bundle them together.


Anyway, back to your problem.  Since your code doesn't have threads, it 
must have an event loop somewhere.  Event loops don't coexist at all 
well with calls to sleep().

     while waiting:
         time.sleep(1)

If you start that code with waiting being true, it will never terminate.

I don't know turtle graphics, but if it's got an event loop, then you 
can't write your program procedurally.  A function called 
"wait_for_click()" is nonsensical.


-- 
DaveA

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


Thread

Detecting a click on the turtle screen when the turtle isn't doing anything? Adam Funk <a24061@ducksburg.com> - 2013-02-05 13:20 +0000
  Re: Detecting a click on the turtle screen when the turtle isn't doing anything? woooee@gmail.com - 2013-02-05 10:08 -0800
    Re: Detecting a click on the turtle screen when the turtle isn't doing anything? Adam Funk <a24061@ducksburg.com> - 2013-02-05 19:58 +0000
      Re: Detecting a click on the turtle screen when the turtle isn't doing anything? Dave Angel <d@davea.name> - 2013-02-05 16:55 -0500
        Re: Detecting a click on the turtle screen when the turtle isn't doing anything? Adam Funk <a24061@ducksburg.com> - 2013-02-06 21:46 +0000
  Re: Detecting a click on the turtle screen when the turtle isn't doing anything? Adam Funk <a24061@ducksburg.com> - 2013-02-05 19:45 +0000
    Re: Detecting a click on the turtle screen when the turtle isn't doing anything? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-05 16:54 -0500
      Re: Detecting a click on the turtle screen when the turtle isn't doing anything? Adam Funk <a24061@ducksburg.com> - 2013-02-06 21:52 +0000

csiph-web