def __shake(self, frame=0):
        "Animate each step of shaking the root window."
        frame += 1
        # Get the window's location and update the X position.
        x, y = map(int, self.__tk.geometry().split('+')[1:])
        x += round(math.sin(math.pi * frame / 2.5) * \
                   math.sin(math.pi * frame / 50) * 5)
        self.__tk.geometry('+{}+{}'.format(x, y))
        if frame < 50:
            # Schedule next step in the animation.
            self.after(20, self.__shake, frame)
        else:
            # Enable operations after one second.
            self.operations_enabled = True
Animate each step of shaking the root window.
recipes/Python/577632_Directory_Pruner_1/recipe-577632.py