# libtmux.Window.rotate

- **Module:** libtmux
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/38e368c11117fb4aeb2f082d552cd4f210eae06a/src/libtmux/window.py#L1035
- **Page:** https://libtmux.org/en/py/stable/reference/libtmux-window-rotate/

```
libtmux.Window.rotate(
    self,
    upward: bool | None = None,
    downward: bool | None = None,
    keep_zoom: bool | None = None,
) -> Window
```

Rotate pane positions in the window via [`$ tmux rotate-window`](/en/tmux/latest/manual/rotate-window/).

## Examples

```python
>>> pane1 = window.active_pane
>>> pane2 = window.split()
>>> window.rotate()
Window(...)
```

## Parameters

- `upward` (`bool | None`): Rotate upward (``-U`` flag).
- `downward` (`bool | None`): Rotate downward (``-D`` flag).
- `keep_zoom` (`bool | None`): Keep the window zoomed if zoomed (``-Z`` flag).

## Returns

:class:`Window`
    Self, for method chaining.

## In other ports

### Rotate panes within a window

- TypeScript: [`window.Window.rotate`](/en/ts/latest/reference/window-window-rotate/) (method)
- Rust: [`window.Window.rotate`](/en/rs/latest/reference/window-window-rotate/) (method)
- Go: [`tmux.Window.Rotate`](/en/go/latest/reference/tmux-window-rotate/) (method)
- Java: [`io.github.libtmux.Window.Window.rotate`](/en/java/latest/reference/io-github-libtmux-window-window-rotate/) (method)
- C#: [`LibTmux.Window.RotateAsync`](/en/csharp/latest/reference/libtmux-window-rotateasync/) (method)
- C++: [`libtmux::Window::rotate`](/en/cxx/latest/reference/libtmux-window-rotate/) (method)
- Swift: [`Server.rotate(_:upward:)`](/en/swift/latest/reference/server-rotate(_-upward-)/) (method)
