[Tutor] Menu to choose programlets: if only python had a GoTO statement ;-))))

Ronald D Stephens rdsteph@earthlink.net
Thu, 12 Apr 2001 17:12:03 -0400


Thanks tremendously!!! I am on my way to your web site right now...!

Ron Stephens


----- Original Message ----- 
From: "Rob Andrews" <randrews@planhouse.com>
To: "Ron Stephens" <rdsteph@earthlink.net>
Cc: <tutor@python.org>
Sent: Friday, April 13, 2001 2:12 PM
Subject: Re: [Tutor] Menu to choose programlets: if only python had a GoTO statement ;-))))


> On Useless Python, I have an example script that uses a GOTO-like structure,
> as well as an example of the next revision which does it without any GOTO
> behavior. The URL for Useless Python is
> http://www.lowerstandard.com/python/pythonsource.html and the two scripts
> are slotmachine.py (the one that acts like it has a GOTO) and zippy.py. Not
> menu-driven, but the behavior is there.
> 
> Hope this helps some at all,
> Rob
> 
> ----- Original Message -----
> From: "Ron Stephens" <rdsteph@earthlink.net>
> To: <tutor@python.org>
> Sent: Thursday, April 12, 2001 12:58 PM
> Subject: [Tutor] Menu to choose programlets: if only python had a GoTO
> statement ;-))))
> 
> 
> > Sacrilege, I know. ;-))) But sometimesIi wonder why no modern language
> > will let me have a simple goto statement when nothing else will do as
> > well...this is a rhetorical statement only...
> >
> > I have written and am writing a series of similar small programs to help
> > a user choose amongst several different alternatives. The programs
> > mostly use simple weighted averages based on several appropriate
> > criteria with weights, or importance levels. Maybe later, Bayes;-)))
> >
> > On such program is general in nature and lets the user input the options
> > to be decided amongst, and then input the criteria to be used to decide
> > and then the weights for each criteria and then the scores for each
> > option on each criteria. Other options are sort of mini expert systems
> > in which the programmer pre inputs the options and criteria and the
> > scores for each option on each criteria, then the user only enters his
> > individual weights amongst the criteria. These programlets can cover any
> > field in which the programmer is "expert".
> >
> > Now, my problem. I want to create a sort of simple menu to offer the
> > user a choice between the various mini-decisonanalysis programs. So, the
> > user can choose the general program, or else a specific program. Once
> > the user chooses, the appropriate mini-progran should launch.
> >
> > If I had goto statements available, my job would be finished. Just
> > create a simple choice, say 1-10 and when the user inputs 10 the program
> > launches its program.
> >
> > I first considered using a Tkinter menu, but I am still struggling with
> > gui event-driven programs. Also, if I use Tkinter, how would I solve my
> > basic problem to jump to each a specific program when the user chooses
> > its menu item? In other words, I would have to launch a procedural
> > program from a gui event-driven menu program.
> >
> > So, now  I consider procedural menu program using raw_input. Still, how
> > do I go to the appropriate sub-program when the user chooses one? With
> > goto's this would be trivial. Now, I consider a nested set of "if "
> > statements that determines which number was chosen, but still how do I
> > "jump" to the correct sub-program??? Even if I define the subprograms as
> > functions even, how do I jump to them???
> >
> > Any help for hopelessly confused newbie will be greatly appreciated...
> >
> > Ron Stephens
> >
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor@python.org
> > http://mail.python.org/mailman/listinfo/tutor
>