[Tutor] My code works but it is a little bit broken.

brandon w bbbgggwww at gmail.com
Tue Sep 27 23:54:50 CEST 2011

That was my problem. I had the "insert" function. I don't know why I did not
see that before or why I even put that in there.
Thank you for your help once again.

On Tue, Sep 27, 2011 at 6:43 AM, Alan Gauld <alan.gauld at btinternet.com>wrote:

> On 27/09/11 02:32, brandon w wrote:
>> The fields take the initial value and multiply it to get the amount.
>> The problem in in the callback function. It uses the <Enter> event to
>> clear a field, but when the mouse enters a second time it adds a numeric
>> value. This is a semantic error. It is not doing what I want it to do.
> Here is the callback function:
> def callback(event):
>    field0 = varText1.get()
>    initAmount.delete(0, END)
>    initAmount.insert(0, field0)
>    return
> It quite clearly does an insert. If you don't want the insert remove it?
> I still don't think I understand what your problem is? You read the field
> and insert it, presumably you did that for a reason, so why are you
> surprised when it works as you designed it to work?
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> ______________________________**_________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/**mailman/listinfo/tutor<http://mail.python.org/mailman/listinfo/tutor>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110927/707503a1/attachment.html>

More information about the Tutor mailing list