Sign in to follow this  

Python - strange behaviour

Recommended Posts

Nickie    322
Hello everyone,
Yesterday I got my homework from my math teacher. We are studing graphs ( f(x) = x^2 for example ) and how to visualize them( yeah I know, easy )
So she gave me the task to write a programm that will print the graph on the screen. I've chosen python because its high lvl language and I do't have exp with it. (I''m using pygame)
I came to the part where I need to grab the mouse coordinates, substract them from the last mouse coords so I can get a vector represention my movement.
elif event.type == MOUSEMOTION:
self.mousepos1 = self.mousepos2
self.mousepos2.x, self.mousepos2.y = event.pos
self.mousemotion.x = self.mousepos2.x - self.mousepos1.x
self.mousemotion.y = self.mousepos2.y - self.mousepos1.y
Sorry for the possibly dumb question but why the hell this prints something like:
[ 614 , 258 ]
[ 625 , 212 ]
[ 0 , 0 ]
[ 0 , 0 ]
NOTE: I was using functions for +, -, * , /, however I put everything here because I have no idea why it is behaving this way(I assumed the functions may be the problem, but it isn't)
EDIT: I'll post the whole code if requiredq just ask - its only 100 lines. I'm using python ver 3.2.2 Edited by Nickie

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this