[Tutor] Re: [Edu-sig] Getting Started
glingl
glingl@mail.rg16.asn-wien.ac.at
Mon, 16 Sep 2002 16:39:50 +0200
--- Randy Latimer <rlatimer@tjhsst.edu> schrieb:
> 1. Simple Question
>
> I want to load a python program and "run" it. For instance, from the
> tutorial:
> def countdown(n):
> if n == 0:
> print "Blastoff!"
> else:
> print n
> countdown(n-1)
>
> I save this as count.py. Go into python. Then what do I do?
>
> Here's the error message I'm getting:
>
> >>> import countdown
> >>> countdown(3)
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> TypeError: object of type 'module' is not callable
> >>>
>
There are two ways to solve this problem, which partially
arises giving to your function the same name as to your
module.
1. way: call countdown.countdown(3)
which means: execute the function countdown (with argument 3)
from module countdown
2. way: change the import statement to
from countdown import countdown
(or: from countdown import * (i. e. everything))
then countdown(3) should work.
Regards, Gregor
> 2. What's the best way to do GUI in python? PyGTK?
>
>
There is no best way, only a best way for you. Depends
on your needs, I think.
> Thanks,
> Randy L
>
>
>
>
> _______________________________________________
> Edu-sig mailing list
> Edu-sig@python.org
> http://mail.python.org/mailman/listinfo/edu-sig
>