If you are painting a floor in a room, and you don't leave yourself a way to avoid stepping on wet paint to get out, then you have the basic idea of this idiom. It means that you have caused a situation for yourself in which you have no alternative, and the result will not be good. The idea is that this is something to avoid in the future.
Example 1: Judy made some bad decisions at a young age, and she painted herself into a corner in life that was hard to get out of.
Example 2: I didn't intend to paint myself into a corner, but when I insulted my thesis adviser, that's what happened.
Example 3: Unfortunately, John's argument with the boss painted him into a corner - he had to quit.