En Sun, 20 Apr 2008 20:24:04 -0300, globalrev <[EMAIL PROTECTED]> escribió:
> in C?? java etc there is usually:
>
> procedure 1
> procedure 2
> procedure 3
>
> main {
> procedure 1
> procedure 2
> procedure 3
> }
>
> i dont get the mainloop() in python. i mean i have written some
> programs, for example a calculator using tkinterGUI.
>
What you call the "mainloop" is the event loop (or message loop) used by
event-driven applications as a way to dispatch all events as they happen in the
system. The concept is independent of Python/C++/whatever language you choose.
The key phrase is "event-driven programming":
http://en.wikipedia.org/wiki/Event_driven_programming
Tkinter provides an event-driven GUI framework. Simple CLI programs are not
event-driven, as your pseudo example above.
> if i have some functions i wanna call to run the program and i wanna
> call them ina specific order and be able to call
> them from each other should this just be called in the mainloop and
> the mianloop then runs the "mainscript" top
> to bottom over and over?
If you don't want or don't require a graphical user interface, just write the
functions you need and call them from the outermost section in your script.
If you do require a GUI, you'll have to write the code in response to user
actions: when the user clicks here, do this; when the user chooses that menu
option, do that.
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list