TypeError

Doug Stanfield DOUGS at oceanic.com
Thu Oct 26 18:26:04 EDT 2000


This is one of those "learning how to dig deeper" kinds of problems.

Blender is a package (which I've never used by the way) that wraps some
functionality up in an object oriented framework.  You're coming at it from
the perspective that it should match your view of reality.  Thats not
necessarily bad, but not useful in this case.  Your logic is correct as
pseudocode, but needs to be translated to use what you are really being
given.

My advice is to start using the interactive interpreter and explore the
structure of things.  You didn't post the whole program you've written, one
of the things the other helpful posters asked for, so the advice you've been
getting is needlessly vague.  My advice will be also, but take it in the
sprit of one trying to "teach you to fish" instead of giving you a fish to
eat.

The only code you posted was:
speedgear = first - second

There will be some amount of code that preceeds that statement.  Start the
Python interpreter by typing 'Python' and return at a command prompt.  Type
in (or copy and paste) all the statements that preceed the questionable
statement above.  You will hopefully see the GUI with the buttons and
everything may appear the same.  As soon as  you type the statement that
defines first (in other words 'first = ...') type 'dir(first)'.  That will
show you all the attributes of the object instance called 'first'.  One of
these may be something called text, label, or something like that.  If you
find something appropriately named, for instance if it was text, you can
access it by using first.text

The alternative to all of that is to read the Blender documentation, find
the description of the 'Button' object, and discover the correct attribute.
That is what is meant by RTFM, in other words, 'Read The Fine Manual'.

HTH

-Doug-
> -----Original Message-----
> From: joonas [mailto:keisari_ at hotmail.com]
> Sent: Thursday, October 26, 2000 9:04 AM
> To: python-list at python.org
> Subject: Re: TypeError
> 
> 
> Btw i am not using Tkinter.
> I am using Blender, that is a 3d modelling software.
> 
> I tried 
> "speedgear.text = str(int(first.text) - 10)"
> and it gave me error,"name error text".
> 
> Then i removed ".text" from objects and it gave me "object cant be
> converted to int".
> 
> Joonas.
> 
> 
> 
> Fredrik Lundh wrote:
> > 
> > Steve wrote:
> > > Look in the Tkinter documentation at the properties of 
> buttons, and
> > > you'll probably find what you need is something like
> > >
> > > sppedgear.text = str(int(first.text) - int(second.text))
> > >
> > > Hope this helps.
> > 
> > not that he's ever gonna tell us (why make it *easy* for
> > people to help you, when you can waste everybody's time
> > by playing stupid guessing games?), but it doesn't look like
> > he's using Tkinter:
> > 
> > >>> w = Tkinter.Button()
> > >>> type(w)
> > <type 'instance'>
> > >>> w
> > <Tkinter.Button instance at 95b938>
> > >>> print w
> > .9812280
> > 
> > (Tkinter's __str__ method returns the internal widget name,
> > which always starts with a dot)
> > 
> > btw, in Tkinter, you can get the button label as first["text"].
> > Data entry widgets usually provide a "get" method.
> > 
> > </F>
> -- 
> http://www.python.org/mailman/listinfo/python-list
> 




More information about the Python-list mailing list