notification window

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By wkytazijqxow

version=latest,Can a window appear at a set position, play a sound, and not focus here, and set “close the window after a few seconds”, such as “notification window”, how to do it?

:bust_in_silhouette: Reply From: GlitchedCode
func notification_show(notif: WindowDialog, sec: float, desired_position: Vector2):
    notif.rect_position = desired_position #moves the window to a location on screen
    notif.visible = true #makes the window visible
    yield(get_tree().create_timer(sec), "timeout") #waits for set amount of seconds
    notif.visible = false #or if instancing when needed, you can queue_free()