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.

David Miller, 24, from Jersey, attended the University of Leeds and had been travelling with Hannah Witheridge, 23, from Norfolk.
Their bodies were found on a beach on Koh Tao in September 2014.
The university awarded Mr Miller a degree in civil and structural engineering.
He had just completed the third year of his degree and was about to start the fourth year of the master of engineering course.
His mother Sue Miller and girlfriend Jessy Howorth collected the degree on his behalf.
The trial of two Burmese men - Zaw Lin and Wai Phyo - accused of murdering the pair continues. Both deny the charges.

Nikola Zhulev, 30, is still charged with murdering 49-year-old Alan Gardner and attempting to defeat the ends of justice by hiding his body.
He was formally acquitted at the High Court in Livingston of stealing Mr Gardner's Toyota 4x4 and valuables from his home in Balbeggie.
Closing speeches in Mr Zhulev's trial will be made today.
Prosecutors also withdrew a charge alleging that Mr Zhulev sold Mr Gardner's gold at a pawn shop and used his credit card to buy takeaway meals.
He was also found not guilty of driving the car without an MoT certificate and possessing and dealing in heroin in the days leading up to the discovery of Mr Gardner's body.
The jury watched a video recording of Mr Zhulev being interviewed by Det Con David Budd on 11 May 2015.
Det Con Budd asked him: "Are you going to tell us anything about what happened?"
Mr Zhulev replied: "No."
He then gave 'no comment' replies to questions about the last time he had contacted or seen Mr Gardner.
The trial before Lady Rae 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.
[NEXT_CONCEPT]
The family of a student murdered on a Thai island have collected their son's posthumous first class degree from the university where he studied.
[NEXT_CONCEPT]
A Bulgarian man accused of murdering a Perthshire jeweller has had theft and fraud charges against him dropped.