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


Groups > comp.lang.python > #54587

Re: Why do I have to use "global" so much when using Turtle?

From Nobody <nobody@nowhere.com>
Subject Re: Why do I have to use "global" so much when using Turtle?
Date 2013-09-22 14:48 +0100
Message-Id <pan.2013.09.22.13.48.57.818000@nowhere.com>
Newsgroups comp.lang.python
References <0b028e65-37b2-492a-83c0-0d76d037c165@googlegroups.com>
Organization Zen Internet

Show all headers | View raw


On Sat, 21 Sep 2013 21:39:07 -0700, John Ladasky wrote:

> However, neither Screen.ontimer() not Screen.onkeypress() appear to give
> me a way to pass arguments to functions of my own.  Why don't they?  Is
> this some limitation of Tk?  I have worked with other GUI's before, and I
> don't remember having to jump through this particular hoop.

The usual approach in Python is to pass a bound method of an object, and
keep all of the data on that object.

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


Thread

Why do I have to use "global" so much when using Turtle? John Ladasky <john_ladasky@sbcglobal.net> - 2013-09-21 21:39 -0700
  Re: Why do I have to use "global" so much when using Turtle? Peter Otten <__peter__@web.de> - 2013-09-22 10:15 +0200
  Re: Why do I have to use "global" so much when using Turtle? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-09-22 10:43 +0000
  Re: Why do I have to use "global" so much when using Turtle? Ned Batchelder <ned@nedbatchelder.com> - 2013-09-22 06:56 -0400
  Re: Why do I have to use "global" so much when using Turtle? Nobody <nobody@nowhere.com> - 2013-09-22 14:48 +0100
  Re: Why do I have to use "global" so much when using Turtle? John Ladasky <john_ladasky@sbcglobal.net> - 2013-09-22 11:57 -0700
    Re: Why do I have to use "global" so much when using Turtle? rusi <rustompmody@gmail.com> - 2013-09-22 18:44 -0700
      Re: Why do I have to use "global" so much when using Turtle? John Ladasky <john_ladasky@sbcglobal.net> - 2013-09-23 00:26 -0700

csiph-web