Does Blender use OpenGl or DirectX? Or is it all done from scratch?
Does Blender use OpenGl or DirectX?

All graphics output of Blender is done using OpenGL.

Or does it use a programming language (python?) to do everything from scratch?

Why "or"? An API doesn't substitute a programming language. Blender has been programmed in C, C++ and Python. OpenGL is used to render everthing on screen, including the user interface.
What was Blender created in?