Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ''' egy kis fill '''
- def fill(self,x,y):
- startcolor=self.kep.getpixel((x,y))
- fillcolor=(255,0,0)
- fillbuffer={}
- fillbuffer[(x,y)]=''
- while len(fillbuffer):
- currentpixel=fillbuffer.popitem()[0]
- for i,j in [(0,1),(0,-1),(1,0),(-1,0)]:
- nezpixel=currentpixel[0]+i,currentpixel[1]+j
- if self.kep.getpixel(nezpixel)==startcolor and 0<nezpixel[0]<249 and 0<nezpixel[1]<249:
- self.rajzol.point(nezpixel,fillcolor)
- if nezpixel not in fillbuffer: #nem tudom hogy igazából kell-e ez ide logikailag igen de amugy csak lassít...
- fillbuffer[nezpixel]=''
- maxlen=max(maxlen,len(fillbuffer))
- self.vaszonkep.paste(self.kep)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement