All praise is due to Allah. May Allah's peace and blessings be upon the Messenger of Allah, his family and companions.
To answer your question I say:
The woman whose husband has died should stay in the house where she was staying when her husband died. This is because Allah the Exalted said, "And those who are taken in death among you and leave wives behind - they, [the wives, shall] wait four months and ten [days]. And when they have fulfilled their term, then there is no blame upon you for what they do with themselves in an acceptable manner. And Allah is [fully] Acquainted with what you do" [al-Baqarah: 234].
However, such a woman is permitted to go out her house for her needs and interests. She was ordered to stay in her house, and not to live in another house. There is nothing that indicates that she is not permitted to go out for her needs. Rather, the Sunnah apparently indicates that she may leave her home for her needs and interests because it was transmitted by Aboo Dawood, at-Tirmithi, and ibn Majah from the hadeeth of Zaynab bint Ka'b ibn 'Ujrah from Fury'ah bint Maalik the sister of Abu Sa'eed al-Khudri that she came to the Prophet (peace be upon him) and requested to return to her family because her husband had followed his slaves, and they killed him. The Prophet (peace be upon him) said, "Stay in your house until the prescribed time ends" and he did not object to her coming out to ask him about this issue. Moreover, the scholars used as evidence the hadeeth which was transmitted by 'Abd ar-Razaaq from Mujaahid through a chain of narrators which does not reach the Prophet (peace be upon him) that, "Some men were martyred during the battle of Uhud. Their wives came to the Messenger of Allah and said, "We feel lonely at night, and sleep in the house of one of us, and the next morning each of us goes to her house. The Prophet (peace be upon him) said, "Talk at the house of one of you as long as you want. However, when you want to sleep each of you should go to her house." This indicates that there is no problem if a woman goes out for her needs. This is the opinion of the majority of the scholars from the adherents of the Fiqh mathabs and others.
The divorced woman has been mentioned in Saheeh Muslim (1483) from the hadeeth of az-Zubayr on the authority of Jaabir that he said, "My maternal aunt was divorced, and she wanted to collect the harvest from her date-palm trees. A man rebuked her for going out to the trees. She went to the Prophet (peace be upon him), who said: 'No, go and collect the harvest from your trees, for perhaps you will give some in charity or do a good deed with it.'" Therefore, the Prophet (peace be upon him) permitted her to go out for a need despite the fact that Allah said, "Do not turn them out of their [husbands'] houses, nor should they [themselves] leave [during that period] unless they are committing a clear immorality" [at-Talaaq: 1]. Thus, this indicates that it is permissible for a woman to leave her house for a need. This is why a number of scholars were of the opinion that a widow may leave her house for her needs based on this proof, and comparison to a divorced woman.
Therefore, the discussion above shows that there is no difference between a widow and a divorced woman in the sense that they may not leave their dwellings during the waiting period. However, they are permitted to go out for a need and benefit. Some scholars restricted this going out to daytime. However, what is apparent is that the women can go out during the night and the day. And Allah knows best.