python - Infinite loop happening within class functions- Pygame -


i'm trying create class object, note, reason i've created loop , class goes through functions infinitely. need x , y permanently change everytime note(a,b,c,d).exnote() on new object, created lists hold x , y values because can change value in list , append value list next time use .exnote() on new object. here code:

class note:     x=[0]     u=-4     y=[0]     def __init__(self, num, staff, note, notetype):         self.staff = staff         self.note = note         self.notetype = notetype         self.num=num     def wstaff(self):         char in self.staff:              if char == int:                 self.y[self.num]+=160*int(char)                 break                 print(self.y)                 print(self.x)              if self.num==0 , char == 'r' , self.notetype=='half':                  self.x[self.num]+=98                  self.y[self.num]+=59     # (51, -4)                  break                  print(self.y)                  print(self.x)              if self.num==0 , char == 'r' , self.notetype=='4th':                  self.x[self.num]+=83                  self.y[self.num]+=62        #(31, -4)                  break                  print(self.y)                  print(self.x)              if self.num==0 , char == 'r' , self.notetype==ethnoteimg:                 self.x[self.num]+=63                 self.y[self.num]+=59       #(17, -4)                 print('wstaff')                 print(self.y)                 print(self.x)              if self.num==0 , char == 'r' , self.notetype=='16th':                 self.x[self.num]+=49                 self.y[self.num]+=54      #(9, -4)                 break              #if num=1 , char = 'l':               #whole note () ()               #half note () ()               #4th note () ()               #8th note () ()               #16th note () ()     def notez(self):         print(self.y[self.num])         self.y[self.num]+=(-4)*int(notede[(str(self.note))])         print('notez')         print(self.y)         print(self.x)     def getcoord(self):         self.wstaff()         self.wnotetype()         self.notez()         print('getcoord')         print(self.y)         print(self.x)     def exnote(self):         self.getcoord()         self.wnotetype()         screen.blit(self.notetype, (self.x[self.num],self.y[self.num]))         print('exnote')         print(self.y)         print(self.x)     def wnotetype(self):         if self.num!=0 , self.notetype == 'ethnoteimg':             self.x.append(self.x[self.num]+17)             self.y.append(self.y[self.num])             print('wnotetype')             print(self.y)             print(self.x)         if self.num!=0 , self.notetype == '4th':  #note(1, '0r', 'd', 'ethnote').exnote()             self.x[self.num]+=31         if self.num!=0 , self.notetype == 'half':             self.x[self.num]+=51         if self.num!=0 , self.notetype == 'whole':             self.x[self.num]+=76.5 

note(0, '0r', 'd', ethnoteimg).exnote() prints out this:

wstaff [59] [63] 59 notez [55] [63] getcoord [55] [63] exnote [55] [63] wstaff [114] [126] 114 notez [110] [126] 

i dont understand why doesn't stop after printing exnote [55] [63] , why goes through of functions. i'm sure has having class functions inside of other functions i've done before without problems.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -