regenerate()
break
+def paste(event):
+ s = tkroot.selection_get()
+ pat = re.compile("[0-7]+")
+ bitmap = []
+ for i in range(YSIZE):
+ m = pat.search(s)
+ if m is None:
+ print("gronk")
+ return
+ bitmap.append(int(m.group(0), 8) & ((1 << XSIZE) - 1))
+ s = s[m.end(0):]
+ for y in range(YSIZE):
+ for x in range(XSIZE):
+ setpixel(x, y, 1 & (bitmap[y] >> (XSIZE-1 - x)))
+ regenerate()
+
def drag(event):
x = (event.x - cont.dragstartx) // pixel
y = (event.y - gutter) // pixel
cont.canvas.bind("<Button-1>", click)
cont.canvas.bind("<B1-Motion>", drag)
+cont.canvas.bind("<Button-2>", paste)
tkroot.bind("<Key>", key)
cont.canvas.pack()