• Create Account

## Python - strange behaviour

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

### #1Nickie  Members

Posted 13 October 2012 - 02:14 AM

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:
print('--------------------')
self.mousepos1 = self.mousepos2
self.mousepos1.Print()
self.mousepos2.x, self.mousepos2.y = event.pos
self.mousepos2.Print()
self.mousemotion.Print()
self.mousemotion.x = self.mousepos2.x - self.mousepos1.x
self.mousemotion.y = self.mousepos2.y - self.mousepos1.y
self.mousemotion.Print()

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, 13 October 2012 - 02:24 AM.

### #2Nickie  Members

Posted 13 October 2012 - 02:54 AM

NEVERMIND!
I've been using something like C's references. Fixed!

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.