jython - animation problem

Rob Hall blokeatiidotnet
Thu May 23 12:05:23 EDT 2002


DOH!!!


"Rune Braathen" <runeb@[remove].eyeone.com> wrote in message
news:uptzmq5yf.fsf at eyeone.com...
> "Rob Hall" <bloke at ii dot net> writes:
>
> > Hi all.
> >
> > Using Jython, I want to animate a rectangle moving across the
> > screen, but am having trouble defining my old and new rectangle.
> > Here's what I have:
>
> Well, the problem really isn't related to the animation...
>
> [ ... ]
>
> >             oldRect = awt.Rectangle
> >             newRect = awt.Rectangle
>
> Here, you bind the name 'oldRect' and 'newRect' to the awt.Rectangle
> class, I believe you want to create instances of the class:
>
> oldRect = awt.Rectangle()
> newRect = awt.Rectangle()
>
> [ ... ]
>
> > (51)     newRect.x = curX
>
> newRect points to the awt.Rectangle class in your code, so here you
> attempt to set the static member 'x' to a value, but the awt.Rectangle
> class have no such member.
>
> > The trouble is, when I run it I get the following error at line 51:
> >
> >  AttributeError: set instance variable as static: public int
> > java.awt.Rectangle.x
> >
> > What am I doing wrong?
>
> Something that will make you say to yourself: "DOH!" :)
>
> --
> runeb
>





More information about the Python-list mailing list