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


Groups > comp.lang.python > #41310 > unrolled thread

What am I doing wrong in this simple tkinter example?

Started by"Yves S. Garret" <yoursurrogategod@gmail.com>
First post2013-03-16 07:53 -0700
Last post2013-03-16 08:16 -0700
Articles 14 — 5 participants

Back to article view | Back to comp.lang.python


Contents

  What am I doing wrong in this simple tkinter example? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-16 07:53 -0700
    Re: What am I doing wrong in this simple tkinter example? Chris Angelico <rosuav@gmail.com> - 2013-03-17 02:08 +1100
      Re: What am I doing wrong in this simple tkinter example? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-16 08:14 -0700
        Re: What am I doing wrong in this simple tkinter example? Christian Gollwitzer <auriocus@gmx.de> - 2013-03-16 16:31 +0100
      Re: What am I doing wrong in this simple tkinter example? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-16 08:14 -0700
    Re: What am I doing wrong in this simple tkinter example? Mitya Sirenef <msirenef@lightbird.net> - 2013-03-16 11:10 -0400
      Re: What am I doing wrong in this simple tkinter example? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-16 08:16 -0700
        Re: What am I doing wrong in this simple tkinter example? Chris Angelico <rosuav@gmail.com> - 2013-03-17 02:23 +1100
          Re: What am I doing wrong in this simple tkinter example? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-16 08:34 -0700
            Re: What am I doing wrong in this simple tkinter example? Chris Angelico <rosuav@gmail.com> - 2013-03-17 02:44 +1100
              Re: What am I doing wrong in this simple tkinter example? Neil Cerutti <neilc@norwich.edu> - 2013-03-19 14:11 +0000
          Re: What am I doing wrong in this simple tkinter example? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-16 08:34 -0700
        Re: What am I doing wrong in this simple tkinter example? Mitya Sirenef <msirenef@lightbird.net> - 2013-03-16 11:48 -0400
      Re: What am I doing wrong in this simple tkinter example? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-16 08:16 -0700

#41310 — What am I doing wrong in this simple tkinter example?

From"Yves S. Garret" <yoursurrogategod@gmail.com>
Date2013-03-16 07:53 -0700
SubjectWhat am I doing wrong in this simple tkinter example?
Message-ID<faa34261-957e-4011-8399-616da73e7a36@googlegroups.com>
Hi all, I'm well into "Python Programming for the Absolute Beginner" in order to 
become more acquainted with the language.  However, when I got to page 304 and 
did my first example:

http://bin.cakephp.org/view/1107093008

And this is the error that I'm getting:

http://bin.cakephp.org/view/399711843

This is the code that came with the book:

http://bin.cakephp.org/view/514822432


What I don't understand is, why am I getting that error?  I've done diff -w
and the code looks for the most part the same.  What am I doing wrong when I
put the application together?

[toc] | [next] | [standalone]


#41311

FromChris Angelico <rosuav@gmail.com>
Date2013-03-17 02:08 +1100
Message-ID<mailman.3364.1363446513.2939.python-list@python.org>
In reply to#41310
On Sun, Mar 17, 2013 at 1:53 AM, Yves S. Garret
<yoursurrogategod@gmail.com> wrote:
> Hi all, I'm well into "Python Programming for the Absolute Beginner" in order to
> become more acquainted with the language.  However, when I got to page 304 and
> did my first example:
>
> http://bin.cakephp.org/view/1107093008
>
> And this is the error that I'm getting:
>
> http://bin.cakephp.org/view/399711843
>
> This is the code that came with the book:
>
> http://bin.cakephp.org/view/514822432
>
>
> What I don't understand is, why am I getting that error?  I've done diff -w
> and the code looks for the most part the same.  What am I doing wrong when I
> put the application together?

    self.secret_txt.delete(0.0, END)
    self.secret_txt.delete(0.0, message)

Is the second one supposed to be adding text? I'm not familiar with
tkinter but that's the line with the error, and it looks a little odd.

ChrisA

[toc] | [prev] | [next] | [standalone]


#41313

From"Yves S. Garret" <yoursurrogategod@gmail.com>
Date2013-03-16 08:14 -0700
Message-ID<1f7985ac-67a7-40ac-bcba-5ee81e832fd7@googlegroups.com>
In reply to#41311
On Saturday, March 16, 2013 11:08:24 AM UTC-4, Chris Angelico wrote:
> On Sun, Mar 17, 2013 at 1:53 AM, Yves S. Garret
> 
> <your...@gmail.com> wrote:
> 
> > Hi all, I'm well into "Python Programming for the Absolute Beginner" in order to
> 
> > become more acquainted with the language.  However, when I got to page 304 and
> 
> > did my first example:
> 
> >
> 
> > http://bin.cakephp.org/view/1107093008
> 
> >
> 
> > And this is the error that I'm getting:
> 
> >
> 
> > http://bin.cakephp.org/view/399711843
> 
> >
> 
> > This is the code that came with the book:
> 
> >
> 
> > http://bin.cakephp.org/view/514822432
> 
> >
> 
> >
> 
> > What I don't understand is, why am I getting that error?  I've done diff -w
> 
> > and the code looks for the most part the same.  What am I doing wrong when I
> 
> > put the application together?
> 
> 
> 
>     self.secret_txt.delete(0.0, END)
> 
>     self.secret_txt.delete(0.0, message)
> 
> 
> 
> Is the second one supposed to be adding text? I'm not familiar with
> 
> tkinter but that's the line with the error, and it looks a little odd.
> 
> 
> 
> ChrisA

Yes, the second line is supposed to add the text.

[toc] | [prev] | [next] | [standalone]


#41318

FromChristian Gollwitzer <auriocus@gmx.de>
Date2013-03-16 16:31 +0100
Message-ID<ki234u$jfp$1@dont-email.me>
In reply to#41313
Am 16.03.13 16:14, schrieb Yves S. Garret:
> On Saturday, March 16, 2013 11:08:24 AM UTC-4, Chris Angelico wrote:
>>
>>      self.secret_txt.delete(0.0, END)
>>      self.secret_txt.delete(0.0, message)
>>
>> Is the second one supposed to be adding text? I'm not familiar with
>> tkinter but that's the line with the error, and it looks a little odd.
>>
> Yes, the second line is supposed to add the text.
>


Think about it. "delete" is not going to add text. You want "insert" 
instead.

	Christian

[toc] | [prev] | [next] | [standalone]


#41323

From"Yves S. Garret" <yoursurrogategod@gmail.com>
Date2013-03-16 08:14 -0700
Message-ID<mailman.3370.1363451993.2939.python-list@python.org>
In reply to#41311
On Saturday, March 16, 2013 11:08:24 AM UTC-4, Chris Angelico wrote:
> On Sun, Mar 17, 2013 at 1:53 AM, Yves S. Garret
> 
> <your...@gmail.com> wrote:
> 
> > Hi all, I'm well into "Python Programming for the Absolute Beginner" in order to
> 
> > become more acquainted with the language.  However, when I got to page 304 and
> 
> > did my first example:
> 
> >
> 
> > http://bin.cakephp.org/view/1107093008
> 
> >
> 
> > And this is the error that I'm getting:
> 
> >
> 
> > http://bin.cakephp.org/view/399711843
> 
> >
> 
> > This is the code that came with the book:
> 
> >
> 
> > http://bin.cakephp.org/view/514822432
> 
> >
> 
> >
> 
> > What I don't understand is, why am I getting that error?  I've done diff -w
> 
> > and the code looks for the most part the same.  What am I doing wrong when I
> 
> > put the application together?
> 
> 
> 
>     self.secret_txt.delete(0.0, END)
> 
>     self.secret_txt.delete(0.0, message)
> 
> 
> 
> Is the second one supposed to be adding text? I'm not familiar with
> 
> tkinter but that's the line with the error, and it looks a little odd.
> 
> 
> 
> ChrisA

Yes, the second line is supposed to add the text.

[toc] | [prev] | [next] | [standalone]


#41312

FromMitya Sirenef <msirenef@lightbird.net>
Date2013-03-16 11:10 -0400
Message-ID<mailman.3365.1363446627.2939.python-list@python.org>
In reply to#41310
On 03/16/2013 10:53 AM, Yves S. Garret wrote:
> Hi all, I'm well into "Python  Programming for the Absolute Beginner" in order to
 > become more acquainted with the language. However, when I got to page 
304 and
 > did my first example:
 >
 > http://bin.cakephp.org/view/1107093008
 >
 > And this is the error that I'm getting:
 >
 > http://bin.cakephp.org/view/399711843
 >
 > This is the code that came with the book:
 >
 > http://bin.cakephp.org/view/514822432
 >
 >
 > What I don't understand is, why am I getting that error? I've done 
diff -w
 > and the code looks for the most part the same. What am I doing wrong 
when I
 > put the application together?


The error is that indexes are supposed to be integers, instead you have
a text string:

"That's not the correct password, so I can't s hare the secret with you."


     -m


-- 
Lark's Tongue Guide to Python: http://lightbird.net/larks/

The existence of any evil anywhere at any time absolutely ruins a total
optimism.  George Santayana

[toc] | [prev] | [next] | [standalone]


#41314

From"Yves S. Garret" <yoursurrogategod@gmail.com>
Date2013-03-16 08:16 -0700
Message-ID<1e8ab690-c0e8-464a-ab13-cd109fc15327@googlegroups.com>
In reply to#41312
On Saturday, March 16, 2013 11:10:07 AM UTC-4, Mitya Sirenef wrote:
> On 03/16/2013 10:53 AM, Yves S. Garret wrote:
> 
> > Hi all, I'm well into "Python  Programming for the Absolute Beginner" in order to
> 
>  > become more acquainted with the language. However, when I got to page 
> 
> 304 and
> 
>  > did my first example:
> 
>  >
> 
>  > http://bin.cakephp.org/view/1107093008
> 
>  >
> 
>  > And this is the error that I'm getting:
> 
>  >
> 
>  > http://bin.cakephp.org/view/399711843
> 
>  >
> 
>  > This is the code that came with the book:
> 
>  >
> 
>  > http://bin.cakephp.org/view/514822432
> 
>  >
> 
>  >
> 
>  > What I don't understand is, why am I getting that error? I've done 
> 
> diff -w
> 
>  > and the code looks for the most part the same. What am I doing wrong 
> 
> when I
> 
>  > put the application together?
> 
> 
> 
> 
> 
> The error is that indexes are supposed to be integers, instead you have
> 
> a text string:
> 
> 
> 
> "That's not the correct password, so I can't s hare the secret with you."
> 
> 
> 
> 
> 
>      -m
> 
> 
> 
> 
> 
> -- 
> 
> Lark's Tongue Guide to Python: http://lightbird.net/larks/
> 
> 
> 
> The existence of any evil anywhere at any time absolutely ruins a total
> 
> optimism.  George Santayana

*shrug*

In the example that I have posted from the book it works just fine.  I also used 
this batch file to help me along.

longevity.py
pause

Hence the question mark over my head at the moment :) .

[toc] | [prev] | [next] | [standalone]


#41316

FromChris Angelico <rosuav@gmail.com>
Date2013-03-17 02:23 +1100
Message-ID<mailman.3367.1363447390.2939.python-list@python.org>
In reply to#41314
On Sun, Mar 17, 2013 at 2:16 AM, Yves S. Garret
<yoursurrogategod@gmail.com> wrote:
> In the example that I have posted from the book it works just fine.

Yep, I just checked the book's version again and the difference is
clear. Check out the two lines I quoted in my previous post, and look
at the corresponding two lines in the book's version. You should see
the difference. :)

By the way, I like the choice of secret. It lends itself well to a
discussion of recursion - how do you live to 99? Live to 98, then be
careful. Etcetera. You need just one special case: How do you live to
1? Be born, then be careful. And there you have it, a perfect problem
for defining recursion vs iteration, as both can do the job!

ChrisA

[toc] | [prev] | [next] | [standalone]


#41319

From"Yves S. Garret" <yoursurrogategod@gmail.com>
Date2013-03-16 08:34 -0700
Message-ID<b5f05451-68bb-491c-a0a2-c9ce8df56154@googlegroups.com>
In reply to#41316
On Saturday, March 16, 2013 11:23:07 AM UTC-4, Chris Angelico wrote:
> On Sun, Mar 17, 2013 at 2:16 AM, Yves S. Garret
> 
> <your...@gmail.com> wrote:
> 
> > In the example that I have posted from the book it works just fine.
> 
> 
> 
> Yep, I just checked the book's version again and the difference is
> 
> clear. Check out the two lines I quoted in my previous post, and look
> 
> at the corresponding two lines in the book's version. You should see
> 
> the difference. :)
> 
> 
> 
> By the way, I like the choice of secret. It lends itself well to a
> 
> discussion of recursion - how do you live to 99? Live to 98, then be
> 
> careful. Etcetera. You need just one special case: How do you live to
> 
> 1? Be born, then be careful. And there you have it, a perfect problem
> 
> for defining recursion vs iteration, as both can do the job!
> 
> 
> 
> ChrisA

*facepalm*

Yep, I see it :) .  Thanks for your help.

[toc] | [prev] | [next] | [standalone]


#41452

FromChris Angelico <rosuav@gmail.com>
Date2013-03-17 02:44 +1100
Message-ID<mailman.3469.1363633718.2939.python-list@python.org>
In reply to#41319
On Sun, Mar 17, 2013 at 2:34 AM, Yves S. Garret
<yoursurrogategod@gmail.com> wrote:
> *facepalm*
>
> Yep, I see it :) .  Thanks for your help.

Glad to be of service. Welcome to a life of programming, where the
palm meets the face on a regular basis... more frequently if you use
Microsoft Windows, tar, non-eight-bit-clean transmission methods, or
Adobe products, and extremely common as soon as you take over someone
else's code [1], but inevitable even without these stimuli. :)

Have fun!

[1] http://www.dilbert.com/strips/comic/2013-02-24/

ChrisA

[toc] | [prev] | [next] | [standalone]


#41499

FromNeil Cerutti <neilc@norwich.edu>
Date2013-03-19 14:11 +0000
Message-ID<aqra00F197kU2@mid.individual.net>
In reply to#41452
On 2013-03-16, Chris Angelico <rosuav@gmail.com> wrote:
> On Sun, Mar 17, 2013 at 2:34 AM, Yves S. Garret
><yoursurrogategod@gmail.com> wrote:
>> *facepalm*
>>
>> Yep, I see it :) .  Thanks for your help.
>
> Glad to be of service. Welcome to a life of programming, where
> the palm meets the face on a regular basis... more frequently
> if you use Microsoft Windows, tar, non-eight-bit-clean
> transmission methods, or Adobe products, and extremely common
> as soon as you take over someone else's code [1], but
> inevitable even without these stimuli. :)

A pretty funny example of this is depicted in the fine film
Office Space.

-- 
Neil Cerutti

[toc] | [prev] | [next] | [standalone]


#41320

From"Yves S. Garret" <yoursurrogategod@gmail.com>
Date2013-03-16 08:34 -0700
Message-ID<mailman.3368.1363448633.2939.python-list@python.org>
In reply to#41316
On Saturday, March 16, 2013 11:23:07 AM UTC-4, Chris Angelico wrote:
> On Sun, Mar 17, 2013 at 2:16 AM, Yves S. Garret
> 
> <your...@gmail.com> wrote:
> 
> > In the example that I have posted from the book it works just fine.
> 
> 
> 
> Yep, I just checked the book's version again and the difference is
> 
> clear. Check out the two lines I quoted in my previous post, and look
> 
> at the corresponding two lines in the book's version. You should see
> 
> the difference. :)
> 
> 
> 
> By the way, I like the choice of secret. It lends itself well to a
> 
> discussion of recursion - how do you live to 99? Live to 98, then be
> 
> careful. Etcetera. You need just one special case: How do you live to
> 
> 1? Be born, then be careful. And there you have it, a perfect problem
> 
> for defining recursion vs iteration, as both can do the job!
> 
> 
> 
> ChrisA

*facepalm*

Yep, I see it :) .  Thanks for your help.

[toc] | [prev] | [next] | [standalone]


#41321

FromMitya Sirenef <msirenef@lightbird.net>
Date2013-03-16 11:48 -0400
Message-ID<mailman.3369.1363448930.2939.python-list@python.org>
In reply to#41314
On 03/16/2013 11:16 AM, Yves S. Garret wrote:
> On Saturday, March 16, 2013 11:10:07 AM UTC-4, Mitya Sirenef wrote:
>> On 03/16/2013 10:53 AM, Yves S. Garret wrote:
>>
>>> Hi all, I'm well into "Python  Programming for the Absolute Beginner" in order to
>>   > become more acquainted with the language. However, when I got to page
>>
>> 304 and
>>
>>   > did my first example:
>>
>>   >
>>
>>   > http://bin.cakephp.org/view/1107093008
>>
>>   >
>>
>>   > And this is the error that I'm getting:
>>
>>   >
>>
>>   > http://bin.cakephp.org/view/399711843
>>
>>   >
>>
>>   > This is the code that came with the book:
>>
>>   >
>>
>>   > http://bin.cakephp.org/view/514822432
>>
>>   >
>>
>>   >
>>
>>   > What I don't understand is, why am I getting that error? I've done
>>
>> diff -w
>>
>>   > and the code looks for the most part the same. What am I doing wrong
>>
>> when I
>>
>>   > put the application together?
>>
>>
>>
>>
>>
>> The error is that indexes are supposed to be integers, instead you have
>>
>> a text string:
>>
>>
>>
>> "That's not the correct password, so I can't s hare the secret with you."
>>
>>
>>
>>
>>
>>       -m
>>
>>
>>
>>
>>
>> -- 
>>
>> Lark's Tongue Guide to Python: http://lightbird.net/larks/
>>
>>
>>
>> The existence of any evil anywhere at any time absolutely ruins a total
>>
>> optimism.  George Santayana
> *shrug*
>
> In the example that I have posted from the book it works just fine.  I also used
> this batch file to help me along.
>
> longevity.py
> pause
>
> Hence the question mark over my head at the moment :) .

You are giving a message to the delete call, but delete call
needs an integer to work. In the book, it's not a delete call
but an insert call that's why it works there.

  -m

-- 
Lark's Tongue Guide to Python: http://lightbird.net/larks/

[toc] | [prev] | [next] | [standalone]


#41315

From"Yves S. Garret" <yoursurrogategod@gmail.com>
Date2013-03-16 08:16 -0700
Message-ID<mailman.3366.1363447019.2939.python-list@python.org>
In reply to#41312
On Saturday, March 16, 2013 11:10:07 AM UTC-4, Mitya Sirenef wrote:
> On 03/16/2013 10:53 AM, Yves S. Garret wrote:
> 
> > Hi all, I'm well into "Python  Programming for the Absolute Beginner" in order to
> 
>  > become more acquainted with the language. However, when I got to page 
> 
> 304 and
> 
>  > did my first example:
> 
>  >
> 
>  > http://bin.cakephp.org/view/1107093008
> 
>  >
> 
>  > And this is the error that I'm getting:
> 
>  >
> 
>  > http://bin.cakephp.org/view/399711843
> 
>  >
> 
>  > This is the code that came with the book:
> 
>  >
> 
>  > http://bin.cakephp.org/view/514822432
> 
>  >
> 
>  >
> 
>  > What I don't understand is, why am I getting that error? I've done 
> 
> diff -w
> 
>  > and the code looks for the most part the same. What am I doing wrong 
> 
> when I
> 
>  > put the application together?
> 
> 
> 
> 
> 
> The error is that indexes are supposed to be integers, instead you have
> 
> a text string:
> 
> 
> 
> "That's not the correct password, so I can't s hare the secret with you."
> 
> 
> 
> 
> 
>      -m
> 
> 
> 
> 
> 
> -- 
> 
> Lark's Tongue Guide to Python: http://lightbird.net/larks/
> 
> 
> 
> The existence of any evil anywhere at any time absolutely ruins a total
> 
> optimism.  George Santayana

*shrug*

In the example that I have posted from the book it works just fine.  I also used 
this batch file to help me along.

longevity.py
pause

Hence the question mark over my head at the moment :) .

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web