'Rotating an object using the angle between its header and click

So I'm building a robot/car in a graphic interface and I was able to make him move to wherever I click. Now I would like it to face the point it is going to move to. I was thinking about having a header in my robot and basically make the robot spin according to the angle between it's header and the line that connects the center of the robot to the point. How can I do such thing?

def move(self):
            
            centro = self.tronco.getCenter()
            
            while (self.win.isOpen()):
                try:
                    mouse = self.win.getMouse()
                except:
                    quit()
                xdist = (mouse.x - centro.x)
                ydist = (mouse.y - centro.y)
                dist = sqrt( (xdist**2) + (ydist**2) )
                if dist == 0:
                    continue
                xincr = xdist / dist
                yincr = ydist / dist
                while (abs(centro.x - mouse.x) >= 0.3 and abs(centro.y - mouse.y) >= 0.3):
                    
                    for part in self.parts:
                        
                        part.move(xincr, yincr)
                            
                    self.win.update()
                    time.sleep(.0005)
                    centro = self.tronco.getCenter()
                
                time.sleep(2)
                    
                self.win.update()
                
                
        def SairDocStation(self):
            
            centro = self.tronco.getCenter()
            
            
            for i in range(70):
                
                for part in self.parts:
                    
                    part.move(0, 1)
                        
                self.win.update()
                time.sleep(.0005)
                centro = self.tronco.getCenter()
                
        def rotation(self):
            
            centro = self.tronco.getCenter()
            centroHeading = self.headingHelper.getCenter()
            
            theta = (centro.x * centroHeading.x + centro.y * centroHeading.y)/(30*dist)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source