Change resource to resource_path to avoid deprecation notice
Move window property initialisation into the window class