From: Richard C. <ax...@ch...> - 2003-09-16 21:52:01
|
hi okay i have a file called pp.py that has a class def in it class _test: def __init__(self): self.arrow1 = arrow(... self.arrow2 = arrow(... def move(self, step): self.arrow1.pos.x = self.arrow1.pos.x + step self.arrow2.pos.x = self.arrow2.pos.x + step now back in another file in the same directory i have import pp #now i create instances of the class like this s1 = pp._test s2 = pp._test #now i have a while loop while 1==1: s1.move(step=-2) s2.move(step=2) now the problem i am having is that it is only showing s2's arrows, throwing in some print statements in between sections of code sometimes i can get it so that s1 arrows you see for a momentum, like flickering but a mostly not displayed. like 10 seconds you dont see s1 and then for a second you do where as s2 you see all the time, it seems almost as if s1 and s2 are sharing the same arrows. How do i stop this from happening, how do i get s1 and s2 to be displayed together/ solid not flicker how it does. what am i doing wrong. Thank you for any help rich |
From: Jonathan B. <jbr...@ea...> - 2003-09-16 22:38:55
|
On Tue, 2003-09-16 at 17:57, Richard Chapman wrote: > hi > > okay i have a file called pp.py that has a class def in it > > class _test: > > def __init__(self): > self.arrow1 = arrow(... > self.arrow2 = arrow(... > > def move(self, step): > self.arrow1.pos.x = self.arrow1.pos.x + step > self.arrow2.pos.x = self.arrow2.pos.x + step > > > now back in another file in the same directory i have > > import pp > > #now i create instances of the class like this > s1 = pp._test > s2 = pp._test > > > #now i have a while loop > while 1==1: > s1.move(step=-2) > s2.move(step=2) > > now the problem i am having is that it is only showing s2's arrows, throwing > in some print statements in between sections of code sometimes i can get it > so that s1 arrows you see for a momentum, like flickering but a mostly not > displayed. like 10 seconds you dont see s1 and then for a second you do > where as s2 you see all the time, it seems almost as if s1 and s2 are > sharing the same arrows. > > How do i stop this from happening, how do i get s1 and s2 to be displayed > together/ solid not flicker how it does. what am i doing wrong. > > > Thank you for any help > > rich > Can you flesh this out to make a complete, reproducible example? This one has syntax errors such that it is not completely clear what you are trying to demonstrate. -Jonathan Brandmeyer |
From: Jim V. <Jim...@no...> - 2003-09-17 14:06:10
|
To further elaborate on Jonathan's request, for example: s = pp._test does not create an instance of the _test class, but s = pp._test() # note parentheses does -- at least as your example defines this class. Jonathan Brandmeyer wrote: > On Tue, 2003-09-16 at 17:57, Richard Chapman wrote: > > hi > > > > okay i have a file called pp.py that has a class def in it > > > > class _test: > > > > def __init__(self): > > self.arrow1 = arrow(... > > self.arrow2 = arrow(... > > > > def move(self, step): > > self.arrow1.pos.x = self.arrow1.pos.x + step > > self.arrow2.pos.x = self.arrow2.pos.x + step > > > > > > now back in another file in the same directory i have > > > > import pp > > > > #now i create instances of the class like this > > s1 = pp._test > > s2 = pp._test > > > > > > #now i have a while loop > > while 1==1: > > s1.move(step=-2) > > s2.move(step=2) > > > > now the problem i am having is that it is only showing s2's arrows, throwing > > in some print statements in between sections of code sometimes i can get it > > so that s1 arrows you see for a momentum, like flickering but a mostly not > > displayed. like 10 seconds you dont see s1 and then for a second you do > > where as s2 you see all the time, it seems almost as if s1 and s2 are > > sharing the same arrows. > > > > How do i stop this from happening, how do i get s1 and s2 to be displayed > > together/ solid not flicker how it does. what am i doing wrong. > > > > > > Thank you for any help > > > > rich > > > > Can you flesh this out to make a complete, reproducible example? This > one has syntax errors such that it is not completely clear what you are > trying to demonstrate. > > -Jonathan Brandmeyer > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users |
From: Bruce S. <bas...@un...> - 2003-09-17 02:31:39
|
The following test routine works for me. Note that in your note you wrote "s1 = pp._test" which should be "s1 = pp._test()". If this example doesn't address your problem, please submit a full test routine. I couldn't reproduce the behavior you describe. from visual import * class _test: def __init__(self): self.arrow1 = arrow(pos=(0,0,0), axis=(1,0,0), color=color.red) self.arrow2 = arrow(pos=(0,0,0), axis=(0,1,0), color=color.cyan) def move(self, step): self.arrow1.pos.x = self.arrow1.pos.x + step self.arrow2.pos.x = self.arrow2.pos.x + step if __name__ == '__main__': # for testing the module #now i create instances of the class like this s1 = _test() s2 = _test() ###now i have a while loop while 1==1: rate(100) s1.move(step=-0.01) s2.move(step=0.01) Richard Chapman wrote: > hi > > okay i have a file called pp.py that has a class def in it > > class _test: > > def __init__(self): > self.arrow1 = arrow(... > self.arrow2 = arrow(... > > def move(self, step): > self.arrow1.pos.x = self.arrow1.pos.x + step > self.arrow2.pos.x = self.arrow2.pos.x + step > > > now back in another file in the same directory i have > > import pp > > #now i create instances of the class like this > s1 = pp._test > s2 = pp._test > > > #now i have a while loop > while 1==1: > s1.move(step=-2) > s2.move(step=2) > > now the problem i am having is that it is only showing s2's arrows, throwing > in some print statements in between sections of code sometimes i can get it > so that s1 arrows you see for a momentum, like flickering but a mostly not > displayed. like 10 seconds you dont see s1 and then for a second you do > where as s2 you see all the time, it seems almost as if s1 and s2 are > sharing the same arrows. > > How do i stop this from happening, how do i get s1 and s2 to be displayed > together/ solid not flicker how it does. what am i doing wrong. > > > Thank you for any help > > rich > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users |