i made a line node like the picture

and i want the line node to not react on mouse left and mouse right event
how to do it in the C++ or python Code?
You can lock the markups node to prevent interaction.
From the Markups module:

From Python/C++:
getNode("MarkupsLine").SetLocked(True)
thank you ,it’s very useful for me