The "7 N" force is set to be vertical since it is the gravitational force on an object.
The "A, B, P" diagram shows that vector [itex]T_A[/itex] is at 30 degrees to the horizontal and so is at 90- 30= 60 degrees to the vertical. That's where they get the angle at the bottom of the triangle. The vector [itex]T_B[/itex] is at 40 degrees to the horizontal and so is at 90- 40= 50 degrees to the vertical. That's where they get the angle at the top of the triangle. Of course, the angles in any triangle add to 180 degrees so the third angle in the triangle is 180- 60- 50= 70 degrees, the last angle in the triangle.