Record time of a second window

Hello,
thanks to the help in this forum, I have created a second window adding the following code on my routine

win.winHandle.minimize() # minimise the PsychoPy window
win.winHandle.set_fullscreen(False) # disable fullscreen
win.flip() # redraw the (minimised) window

win2 = visual.Window(size=[800, 300],color = 'black', fullscr=False)
message = visual.TextStim(win2, text= 'Press the space bar to go back to large screen to select the game')
message.draw()#Draws the text/stimuli
win2.flip()#Flips the screen to reveal the stimulus
event.waitKeys() #Waits for any key press to switch screens
win2.close

However, It does not record time onset-offset and rt of win2. I need to know how long the text is display before the examiner press the space bar. How do I do that?
Thank you
Elisabetta

message.draw() # Draws the text/stimuli
win2.flip() # Flips the screen to reveal the stimulus

# NEW (start timing):
pause_timer = core.Clock()

event.waitKeys(keyList = ['space']) # Wait for space bar to switch screens

# NEW (store data):
thisExp.addData('pause_duration', pause_timer.getTime())

win2.close

PS Please only post questions once. I’ve deleted the duplicate question posted under another topic.