As you said you had not been prescribed any medications to perhaps bring on the weight gain, then one of the thing causing this could be a lack of exercise. It follows that if you are in pain, then of course you will not feel able nor want to move about as much as you once did.
If you are able to do say a little more walking, hard as it may be, then this might be worthwhile and also help psychologically. The thing is when anything traumatic happens in our lives we obviously can get depressed - any major illness diagnosis causes such emotional upset that this needs to be looked into as well as the medications for the illness. Unfortunatly a lot of doctors people don't think of this but if you can discuss this with anyone then it might go a way into helping you with the weight gain issue.
Also when we get emotionally stressed, it makes us feel so bad and sometimes people turn to food as a comfort source - I am not saying you have of course - but just another idea of how you might have gained weight.
Hope this helps, take care