[Tutor] Whack-a-mole

2014-10-01 Thread Ben Smith
Hi, Can anyone help explain why you can keep hitting the Mole even when 
hittable should be False?

from tkinter import *

root = Tk()
#root.state('zoomed')
sec = 0
points=0
pic=PhotoImage(file='Dirt.gif')
pic2=PhotoImage(file='Mole.gif')
hittable=False

def HIT():
if hittable==True:
global points;points+=1
butty.configure(image=pic)
labby.configure(text=points)

def tick():
global sec, hittable
sec += 1
if sec == 3:
hittable=True
butty.configure(image=pic2)
if sec==6:
hittable=False
butty.configure(image=pic)
time['text'] = sec
time.after(1000, tick)

time = Label(root)
time.pack()
labby = Label(root, text="POINTS");labby.pack()
Button(root, text='Start', command=tick).pack()

butty=Button(root, image=pic, command=HIT);butty.pack()

root.mainloop()



This email and any attachments sent with it are intended only for the named 
recipient. If you are not that person please contact us immediately through our 
website and delete this message from your computer. You should not disclose the 
content nor take, retain or distribute any copies. No responsibility is 
accepted by AKS, United Learning or any associated entity for the contents of 
e-mails unconnected with their business. No responsibility is accepted for any 
loss or damage caused due to any virus attached to this email.

AKS is part of United Learning, comprising: UCST (Registered in England No: 
2780748. Charity No. 1016538) and ULT (Registered in England No. 4439859. An 
Exempt Charity).
Companies limited by guarantee.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 129, Issue 22

2014-11-11 Thread Ben Smith
Hi - I'm a teacher & sometimes when we're holding a two minute silence for an 
important occasion an
email comes through & makes my computer ping loudly. Is there a python script 
to stop these kind of things happening?

;)

-Original Message-
From: Tutor [mailto:tutor-bounces+ben.smith=arnoldkeqms@python.org] On 
Behalf Of tutor-requ...@python.org
Sent: 11 November 2014 11:00
To: tutor@python.org
Subject: Tutor Digest, Vol 129, Issue 22

Send Tutor mailing list submissions to
tutor@python.org

To subscribe or unsubscribe via the World Wide Web, visit
https://mail.python.org/mailman/listinfo/tutor
or, via email, send a message with subject or body 'help' to
tutor-requ...@python.org

You can reach the person managing the list at
tutor-ow...@python.org

When replying, please edit your Subject line so it is more specific than "Re: 
Contents of Tutor digest..."


Today's Topics:

   1. Re: http  question (Clayton Kirkwood)
   2. Re: ?has a value of True? versus ?evaluates true? (was: don't
  understand iteration) (wesley chun)
   3. Re: don't understand iteration (Alan Gauld)


--

Message: 1
Date: Mon, 10 Nov 2014 20:52:23 -0800
From: "Clayton Kirkwood" 
To: 
Subject: Re: [Tutor] http  question
Message-ID: <01c801cffd6b$492408a0$db6c19e0$@us>
Content-Type: text/plain;   charset="us-ascii"



>-Original Message-
>From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
>Behalf Of Steven D'Aprano
>Sent: Sunday, November 09, 2014 3:04 AM
>To: tutor@python.org
>Subject: Re: [Tutor] http question
>
>On Sat, Nov 08, 2014 at 09:53:33PM -0800, Clayton Kirkwood wrote:
>
>> >> but I also am aware of httplib2, but it still seems to be in
>> >> eternal alpha.
>> >
>> >What leads you to that conclusion? If you're talking about this:
>> >
>> >https://github.com/jcgregorio/httplib2
>> >
>> >I don't see any sign that it is alpha version software. According to
>> >the readme file, it is at version 0.8.
>> >
>> >I don't see any signs that the author publicly releases any alpha or
>> >beta versions, they all appear to be ready for production. But if
>> >you have seen something that suggests otherwise, please point it
>> >out, because I'm happy to be corrected.
>>
>> Well, I work from the premise that 0.anything is still a work in
>> progress
>
>All software is always a work in progress, until such time it is
>abandoned.

And how do you determine the abandoned timestamp? If I remember correctly, this 
hasn't been updated for several years, and a job for a customer shouldn't be 
based on 0.*, years old hypothetical's. It sounds like a very usable product.

>
>> and hasn't gotten to a point where the author is comfortable with
>> general use. I am sure that you disagree.
>
>In the FOSS (Free and Open Source Software) community, version 0.x does
>not always carry connotations of being unready for use. It may, or it
>may not. But normally "alpha" software will have an "a" in the version
>number, e.g. 0.7a, 0.7b for beta, 0.7rc1 (release candidate 1), 0.7 is
>ready for production.
>
>What matters is not my opinion, or yours, but that of the author of the
>software, and I don't know what that is.
>
>
>--
>Steve
>___
>Tutor maillist  -  Tutor@python.org
>To unsubscribe or change subscription options:
>https://mail.python.org/mailman/listinfo/tutor





--

Message: 2
Date: Mon, 10 Nov 2014 23:35:07 -0800
From: wesley chun 
To: c...@godblessthe.us
Cc: tutor , Ben Finney 
Subject: Re: [Tutor] ?has a value of True? versus ?evaluates true?
(was: don't understand iteration)
Message-ID:

Content-Type: text/plain; charset="utf-8"

good catch, and definitely a distinction beginners should be more cognizant of.

it's also good to recognize that a call to "bool(match)" would render that 
statement correct, as the built-in/factory function will return what an object 
evaluates to (True [re.match object] or/vs.False [None]).

On Mon, Nov 10, 2014 at 5:31 PM, Clayton Kirkwood 
wrote:

> I reported it. I feel all grown up now. Kind of like one of the
> boys(girls...)
>
> Clayton:<)
>
>
> >-Original Message-
> >From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
> >Behalf Of Ben Finney
> >Sent: Monday, November 10, 2014 3:24 PM
> >To: tutor@python.org
> >Subject: [Tutor] ?has a value of True? versus ?evaluates true? (was:
> >don't understand iteration)
> >
> >"Clayton Kirkwood"  writes:
> >
> >> Also of confusion, the library reference says:
> >>
> >> Match objects always have a boolean value of True. Since match()
> >> and
> >> search() return None when there is no match, you can test whether
> >> there was a match with a simple if statement:
> >>
> >> match = re.search(pattern, string)
> >> if match:
> >> process(match)
> >
> >The documentation is incorrect, as you point out: ?have a boolean
> >val