def keypadevent(event): mods = pygame.key.get_mods() if event.key == pygame.K_ESCAPE: sys.exit() elif event.key == pygame.K_RETURN: REDRAW = True elif event.key == pygame.K_KP8: iterations = int(iterations *1.125) if iterations <= 1: iterations = 1 elif event.key == pygame.K_KP5: iterations = int(iterations *10) if iterations <= 1: iterations = 1 elif event.key == pygame.K_KP2: iterations = int(iterations/3) if iterations <= 1: iterations = 1 elif event.key == pygame.K_KP9: Coords = zoomIn(Coords,0.125) elif event.key == pygame.K_KP6: Coords = zoomIn(Coords,0.90) elif event.key == pygame.K_KP3: Coords = zoomOut(Coords,1/3) elif event.key == pygame.K_KP7: colorBands = colorBands +1 Colors = gradient.gradient_list(color1,color2,NumberOfColors,colorBands) elif event.key == pygame.K_KP4: colorBands = colorBands *10 Colors = gradient.gradient_list(color1,color2,NumberOfColors,colorBands) if colorBands <= 1: colorBands = 1 elif event.key == pygame.K_KP1: colorBands = int(colorBands /10) if colorBands <= 1: colorBands = 1 print("colorBands:",colorBands,"Iterations:",iterations)
import sys, os import time, datetime import gradient7 as gradient import messenger pygame.init() screenWidth = 320 screenHeight = 240 iterations = 32 frameCount = 0 NumberOfColors = 128 colorBands = int(screenWidth/NumberOfColors) color1 = (0,0,0) color2 = (255,255,255) Colors = gradient.gradient_list(color1,color2,NumberOfColors,colorBands) date = time.strftime("%Y%m%d") folderPath = "Images\\" + str(date + "\\") ### defining starting coordinates ### Coords0 = (-2,1.0,-1,1.0) Coords1 = (-1.79,-1.74,-0.02,0.02) Coords2 = (-1.804,-1.800,-0.02, 0.02) Coords3 = (-1.7864843750000001,-1.785703125,-0.0003125,0.0003125) interesting = 0.591 Coords4 = (0.24998645125,interesting,-0.5,0.5) Coords5 = (0.2816,0,28362157666381815,0.018,0.11464) Coords = Coords0
import gradient7 as gradient pygame.init() screenWidth = 1280 screenHeight = 200 colors = 640 colorBands = 1 + int(screenWidth/colors) screen = pygame.display.set_mode((screenWidth, screenHeight)) grid = pygame.PixelArray(screen) #columns = int(1 + (screenWidth / steps)) colorgradient = gradient.gradient_list((0,0,0),(255,255,255),colors,colorBands) print("colorgradient:",len(colorgradient)) colorgradient.append(gradient.gradient_list((0,0,0),(255,255,255),colors,colorBands)) print("colorgradient:",len(colorgradient)) size = len(colorgradient) step = int(screenWidth/size) if step == 0: step = 1 for i in range(screenWidth): print("colors=",size,"index=",i,"Indexed Color::") print(colorgradient[i]) grid[i] = colorgradient[i] pygame.display.flip()