def toggle_wrap(window, event): from topologies._topology import topology if window.world.topology.type == 'torus': window.world.topology = topology('rectangle') elif window.world.topology.type == 'rectangle': window.world.topology = topology('torus')