On 3/30/07, Richard Brown <[EMAIL PROTECTED]> wrote:
> On 30/03/07, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> >
> > Not sure what region[:] is supposed to achieve.  You are creating a copy
> > with the same name, so you are over-riding the original variable.
> >
>
> That doesn't seem to be the case - it returns the right thing on the
> first call - i.e. region got changed, but on subsequent calls the
> figure is displayed and the function returns array([0,0,0,0]). I
> thought taking the slice just gave access to the internals of region
> ...
>
> How does one assign a new value to a variable in a containing scope?

You can declare the "region" variable as global in keypressed():

def keypressed(event):
    global region
    region = ...

and "region" does not need to get initialized in the containing scope.


Cheers,

  ~ Antonio

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to