Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_1D_Step_Waves.py
- '''
- create step waves
- '''
- from tkinter import *
- import PIL
- import math
- import random
- ww = 1400
- hh = 600
- root=Tk()
- canvas = Canvas(root,width=ww,height=hh,bg='black')
- canvas.grid(row=0,column=0,sticky=N+S+E+W)
- 0
- def oRGB(rgb):
- r,g,b = rgb
- return "#%02x%02x%02x" % (r,g,b)
- def plot(x):
- canvas.create_line((x, 0, x, y), fill=color)
- 0
- def init():
- global y
- canvas.delete('all')
- for x1 in range(0,ww,10):
- target = max(20,min(hh-20,y+random.randint(-10,10)))
- for x2 in range(0,10):
- y = target
- plot(x1+x2+2)
- canvas.update()
- rgb = 255,255,0 # yellow
- color = oRGB(rgb)
- y = hh/2
- init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement