On Friday, January 29, 2016 at 9:39:40 AM UTC-8, xueng wrote:
>
> This is an example : the value of np transmitted through the defined
> integer_box fonction is effective in that function but is not transmitted
> outside by the "return npmax" so the second while does not "feels" the
> change.
>
The python language provides a way to force variables to be global
variables:
def integer_box(...):
global npmax
...
with that in place, the second while should be totally sensitive to the
assignments that happen in integer_box.
I'm not so sure it's a very good design to use "interact"s to set global
parameters, but you'll find out whether it is or not if you continue with
your project.
>
>
>
> npmax=8
> np=0
> @interact
> #np=integerbox(message="entrez le nb de paroies du projet",title="Les
> paroies du projet")
> def integer_box(np=('entrez le nb de paroies du projet',0)):
>
>
> print "votre projet comporte "+str(np)+" paroies"
> npmax=np
> n = 0
> while n < npmax:
> print n
> n += 1
>
>
> return npmax
> print '******'
> print
> print
> print npmax
> print
>
> n = 0
> while n < npmax:
> print n
> n += 1
>
>
> if(np==0 or np==' '):
> print 'np should be between 1 and npmax','npmax=',npmax,'np=',np
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Le mercredi 27 janvier 2016 à 16:08 -0800, William Stein a écrit :
>
> On Tue, Jan 26, 2016 at 10:00 AM, peigneux
> <[email protected] <javascript:>> wrote:
> > I am sorry to disturb with probably an evident problem.
> > I tested a lot of exemples in sage cloud with @interact to pass parameter
> > values , but these parameter are local
> > to the def function which follows @interact and I don't know how to pass
> > these parameters values outside this function
> > to continue . As I tried to use several @interact and their def function
> > inside a larger code, which was running locally in python before and where
> > the parameters was entered with using "easygui" that I have locally.Thanks
> > for hints
>
> Provide a complete minimal example that illustrates the question you
> are trying to ask.
>
> William
>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "sage-support" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected] <javascript:>.
> > To post to this group, send email to [email protected]
> > <javascript:>.
> > Visit this group at https://groups.google.com/group/sage-support.
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
> William (http://wstein.org)
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.