Fibonacci numbers/program

Alex Martelli aleaxit at yahoo.com
Sat Jan 6 05:07:32 EST 2001


"Eric Anechiarico" <wedjlok at excite.com> wrote in message
news:936gsv$3r1$1 at nnrp1.deja.com...
> Hello,
>
> I am making a program to find Fibonacci number sequences and I wanted to
> know, being fairly new at python, how to get it to open a window to ask
> for the input for the ranges of numbers that I want it to search
> between, as well as to save the output to a text file so taht I do not
> have to look at the window and copy/paste the numbers it returns, since

Writing to a file is very easy.  You open the file for writing with
fileobj = open(filename,"w"), then you can use its fileobj.write(s)
method to write any string s to it -- just build the string s as you
wish, e.g., str(anumber)+'\n' to emit the stringform of anumber
followed by an end-of-line.

As for a GUI, you have various choices, but Tkinter is probably the
simplest toolkit to use in your case (on a Mac).  I have no Tkinter
on Mac experience (no Mac experience at all, actually) so I'll
refrain from any specifics, just in case there are specific issues
I'm unaware of...


Alex






More information about the Python-list mailing list