Re: [Tutor] Images, and other things.

2009-10-02 Thread Kent Johnson
On Tue, Sep 29, 2009 at 7:00 PM, Corey Richardson  wrote:
> I haven't looked into this, but could you make a real time image using
> python? I think it would be most hard
> Anyway, I am having trouble with int(). I am trying to int(raw_input("some
> number")), but it returns
> Traceback (most recent call last):
>  File "C:/Users/Quick-Start/Documents/Python Doc's/Game_File", line 94, in
> 
>   fatness = int(raw_input("How many candies do you want to eat? :"))
> TypeError: 'int' object is not callable

You probably have a line like
  int = 3
in your program which rebinds the built-in int() function to a
(non-callable) int object.

Showing the whole program would help.

Kent
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Images, and other things.

2009-09-29 Thread Luke Paireepinart
On Wed, Sep 30, 2009 at 1:29 AM, Corey Richardson  wrote:

> One of my friends was asking if you could make a game using python, but he
> meant a Graphics, not text game. I was wondering if that was doable.
>

Yes, there are many libraries available for doing this.  Pyglet is my
favorite, but Pygame and PyOGRE and Panda and many others exist.  It's not
just doable, it's probably preferable to write a game in Python.  It'll be
much quicker to finish it than most other languages.

>
> Anywaymy code.
> name = raw_input("What is your name?")
> print "Hello, ", name
> int = 10  #Define the abilities.
>
... and here's your problem.  You defined  a variable named "int" and you
hid the "int" function so when you tried to call int(something) you were
using this variable you just defined instead of the conversion function.

> str = 10
>
This is also a bad function name because "str" is the function to convert a
value to a string.

Also, make sure you reply using "reply-all" so your message goes to the list
rather than directly to me.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Images, and other things.

2009-09-29 Thread Luke Paireepinart
On Tue, Sep 29, 2009 at 6:00 PM, Corey Richardson  wrote:

> I haven't looked into this, but could you make a real time image using
> python? I think it would be most hard
>
I haven't looked into this, but perhaps your questions are too vague?  I
think that may be the case
 What do you mean by real-time image?

Anyway, I am having trouble with int(). I am trying to int(raw_input("some
> number")), but it returns
> Traceback (most recent call last):
>  File "C:/Users/Quick-Start/Documents/Python Doc's/Game_File", line 94, in
> 
>   fatness = int(raw_input("How many candies do you want to eat? :"))
> TypeError: 'int' object is not callable
>
>
> Do I need to import a module or something? I am using 2.6.2, possibly
> upgrading to 3.x later...
>
Give us your whole code, not just the traceback, and we will be more able to
help you.

Also, read  http://catb.org/~esr/faqs/smart-questions.html .  It will help
you get better, less sarcastic answers to your questions.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor