Re: global variable not working inside function. Increment

2013-05-13 Thread Andreas Perstinger
"feather.duster.kung.fu" wrote: >I'm just learning Python and NONE of the tutorials I read said >anything about that . In fact they all say a global can be called from >inside a Function. If possible please contact the ppl that write these >things. Well, we don't know which tutorials you read. So

Re: global variable not working inside function. Increment

2013-05-13 Thread Jean-Michel Pichavant
> Thank You for setting that straight. I'm just learning Python and > NONE of the tutorials I read said anything about that . In fact they > all say a global can be called from inside a Function. If possible > please contact the ppl that write these things.I've heard of > Ocam's razor but not H

Re: global variable not working inside function. Increment

2013-05-13 Thread feather.duster.kung.fu
On Monday, May 13, 2013 7:10:50 AM UTC-7, charles benoit wrote: > On Friday, September 4, 2009 4:52:11 PM UTC-7, Rami Chowdhury wrote: > > > > global no_picked > > > > no_picked = 0 > > > > > > > > def picked(object, event): > > > > no_picked += 1 > > > > print

Re: global variable not working inside function. Increment

2013-05-13 Thread charles benoit
On Friday, September 4, 2009 4:52:11 PM UTC-7, Rami Chowdhury wrote: > > global no_picked > > no_picked = 0 > > > > def picked(object, event): > > no_picked += 1 > > print no_picked > > In order to be able to affect variables in the global scope, you need to > dec

Re: global variable not working inside function. Increment

2013-05-13 Thread feather . duster . kung . fu
On Friday, September 4, 2009 4:43:27 PM UTC-7, Helvin wrote: > Hi, > > This increment thing is driving me nearly to the nuts-stage. > < > > I have a function that allows me to pick points. I want to count the > number of times I have picked points. > > global no_picked > no_picked = 0 >

Re: global variable not working inside function. Increment

2009-09-04 Thread Helvin Lui
Wow!!! Thanks a million!! It worked! = DThanks for the fast reply too! Helvin On Sat, Sep 5, 2009 at 11:52 AM, Rami Chowdhury wrote: >global no_picked >>no_picked = 0 >> >>def picked(object, event): >> no_picked += 1 >> print no_picked >> > > In order to be able t

Re: global variable not working inside function. Increment

2009-09-04 Thread Rami Chowdhury
global no_picked no_picked = 0 def picked(object, event): no_picked += 1 print no_picked In order to be able to affect variables in the global scope, you need to declare them global inside the function, and not at the global scope. So your code should read:

global variable not working inside function. Increment

2009-09-04 Thread Helvin
Hi, This increment thing is driving me nearly to the nuts-stage. > < I have a function that allows me to pick points. I want to count the number of times I have picked points. global no_picked no_picked = 0 def picked(object, event): no_picked += 1 print no_picke