How can I do sliding window on DNA sequence alignment?

How can I do sliding window on dna sequence alignment dot matrix? I was trying to do something like this, but I don't know how to end this.

import numpy as np
import matplotlib.pyplot as plt

X = ""
Y = ""
X = np.array(list(X))
Y = np.array(list(Y))
c = X == Y[:, None]
print(c)
for p in c:
    t = 0
while p == True:
    t = t + 1
if t < 7:

And I was trying to use this code, I found this on internet and I want to try this and see how it works. But it doesn't and I don't know why.

def simpleDotPlot(s1, s2, wsize):
    row = 0
    vWindow = [] #vertical windows
    for c2 in s2:
        vWindow.append(c2)
        if row>=wsize-1:
            if row>=wsize:
                vWindow.pop(0) #remove the first item.
            print (vWindow[0]),
            hWindow = []
            col = 0
            for c1 in s1:
                hWindow.append(c1)
                if col>=wsize - 1:
                    if col>=wsize:
                        hWindow.pop(0)
                    if hWindow==vWindow:
                        print ('X'),
                    else:
                        print ("."),
                col += 1
            for c in range(wsize-1):
                print ('.'),
            print
        row+=1
simpleDotPlot("dorothyhodgkin", "dorothycrowfoothodgkin",1)

I want to have somrting that can filter the noise in the alignment, that I can see just the main alignment bigger than 1. Thank you for any help,