David Harris, 68, denies three counts of soliciting to murder Hazel Allinson, a former TV scriptwriter for The Bill.
He told jurors at the Old Bailey he had become "besotted" with a younger woman in a brothel and spent £50,000 on her.
When the money ran out he was "inspired to write a thriller", to recoup his expenses, the court heard.
The prosecution alleged Mr Harris wanted Ms Allinson's money and full ownership of the £800,000 home they shared in Amberley, West Sussex.
Mr Harris told the jury earlier he had offered a man posing as a hitman £150,000 to kill his wealthy partner as research for his book.
Unbeknown to Mr Harris the contact was an undercover policeman.
The defendant told the jury: "I said I wanted my wife killed - which is not true.
"The figure of £150,000 was mentioned by me, bearing in mind I have no money and I wanted to get this person on side to help me with my story."
Mr Harris told the jury: "He said: 'Yeah, for that kind of money, I will go down there now and shoot her.'
"I said: 'Of course not, you cannot do something like that. It has to be planned'."
The contact said for £175,000 he would "do it now", the court heard.
They allegedly discussed scenarios including a potential mugging or carjacking, before Mr Harris returned home to enjoy a fish supper, watching Strictly Come Dancing, with Ms Allinson.
Mr Harris said: "What I needed for my book was a fatal murder."
He had apparently ruled out any sort of car accident because there was no guarantee that would ensure death.
The couple first met in 1989 when they were both working on The Bill. Ms Allinson had saved him from alcohol addiction and he retired through "ill health" in 2006, Mr Harris said.
Ms Allinson gave him a monthly allowance of between £300-£400.
He told jurors on Wednesday he still had an "active libido" and visited brothels to fulfil his sexual needs.
He met his mistress Ugne Cekaviciute in Worthing and said: "I had become besotted with her. I thought that she was too young and too nice to be in a brothel."
He took her to expensive restaurants and hotels and spent all the money Ms Allison gave him.
Jurors heard he wanted to be with Ms Cekaviciute but was "very stressed" about his finances.
The trial continues.
A man who offered to pay a "hitman" £150,000 to kill his wife, says he had no intention of going through with it and was only researching for his novel.