My wife studied basic-to-midlevel (by school standards) programming in upper secondary school, but then she didn't go further than that, and slowly lost the grip of it and didn't think about it for years. A few months after we started dating, she said she would like me to teach her (I'm a professional developer), and I was happy to say yes.
A bit of background: I have a Master's Degree in Electronic Engineering, and I'm used to studying and learning things in a variety of fields. I'm far from what you would call a workaholic ("study-holic", maybe?), as my will is not strong enough to make me study and work to the point of fatigue; but I've always made up for it with the natural gift of curiosity. If something is interesting or intrigues me, then I get absorbed into it, and I won't stop it working on it (or thinking about it) until I'm satisfied with my results.
On the other hand, my wife pretty much stopped studying after upper secondary school. She started university, then switched to another one the next year, but dropped out of both. She had a very unsupportive boyfriend at the time, who kept telling her that she wouldn't make it and that it wasn't important anyway (he also had some very retrograde ideas about the role of women in the family), which, together with similar discouragement from some of her school teachers, led her to serious confidence issues. I worked hard to help her overcome it in the four years we've been together, and the results definitely show up, but she's not what you would call a strong and confident woman yet. She definitely has great qualities, but she can't fully accept the idea that "she can do it".
Further background info: I've always been a quick learner, and I've often been the one who "tutored" his schoolmates when studying together. This went on through university, even officially for a short time (I've been a teacher's assistant for a course after getting my bachelor), and when I started working (never in the academy) I've been occasionally tutoring university students. I've had decent-to-great results with my "pupils"; however, I've never received formal training in education, and the only reason I would say I'm a teacher (which I'm really not) is because I "taught people" in the past.
Now to the main issue. Our home-made programming course isn't really going great. My wife definitely made progress, and managed to grasp fairly advanced concepts, but she has a very hard time putting them into practice. She is weak even in basic code-writing skills, which makes it ultimately pointless that she understands more advanced concepts. What bugs me is that what she easily accomplishes today, she may completely screw up tomorrow, for no apparent reasons. Moreover, she is not used any more to studying (we're both 34 and we've been out of school/university for more then ten years), and when difficulty arises her lack of self-confidence shows up and drives her into a downward spiral.
I realized more than once that I was making mistakes in my teaching. I'm a fairly advanced developer and I always try to learn new techniques, which means I'm used to overcoming learning curves; however, this also means that I had become fairly disconnected from the reality of a beginner, who may find it difficult to work with concepts that I would call extremely basic. I've done my best to "reset" a few times, to start back from the basics, to not give anything for granted, and to let her take her time to take concepts in.
However, things are not really going as expected. For example, we've had good "lessons" in the last two weeks, she seemed to really move forward, I decided not to advance and to suggest exercises that are a bit of "more of the same", in order to help her build confidence. Last night, she got stuck, so I guided her for a short while, but she quickly lost it, said she wasn't understanding, she kept interrupting my explanations and she concluded "you could just write it yourself then".
My biggest problem is that I don't know how to handle such a situation. She kind of panics, she reverts back to her "I can't understand" self-blaming and self-despising self, which in turn makes me nervous and gradually angrier, to the point where I lose it too and we end up fighting. I'm aware it's a personal issue for me: I've tutored both guys and girls that occasionally went down that same road, but I always stopped that before it reached a critical point. I can't manage to do that with my wife: I take it personally, both because she can't stop panicking and let her mind take control again, and because she isn't listening to me (or, to put it another way, I am ineffective in helping her).
When that happens, especially when it's something like "you did it yesterday, why you can't do it now?", I end up saying that she's not being committed, that maybe that night is not a good night for her, that she should stop and pick it up when she feels more willing to put efforts into it; she replies that I'm being harsh, that I was teaching badly that night, and that I've been scolding her too much "for every mistake".
To clarify: I love her a lot, she loves me a lot: we fight, but we never question our feelings for each other. I know this sounds cliché, but I get angry because I love her, and I only wish to see her happy with herself, to show her she can do way more than she thinks.
So, to sum a very long post (sorry about that, but I thought the situation needed thorough explaining): what can I do to handle a situation where she apparently refuses to listen while I try to teach her and help her?
Please, don't suggest things like "you should be more patient", "she should be more committed". We know it's true: we're trying to, but it's not working. I would greatly appreciate actionable advice, like "try to do this" or "avoid doing that". Thank you for your understanding.
UPDATE
Many thanks to all of you. I got a lot of helpful advice; my wife and I haven't had another lesson yet, but we talked about it and we're willing to pick it up again next week with new energy and better understanding. You gave me great tips in many different regards: teaching in general, teaching programming in particular, and a bit of much-needed psychology (and reality checks, too). I'll do my best to put it all to good use.
I'm not sure how to handle the SE side of this question, though. I probably upvoted a dozen answers, because they're insightful and helpful, but I cannot pick one for the coveted green tick. I'll be in meta to check out what to do :)