# libtmux.Window.new_pane

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

```
libtmux.Window.new_pane(
    self,
    target: int | str | None = None,
    start_directory: StrPath | None = None,
    attach: bool = False,
    shell: str | None = None,
    environment: dict[str, str] | None = None,
    width: int | None = None,
    height: int | None = None,
    x: int | None = None,
    y: int | None = None,
    zoom: bool | None = None,
    empty: bool | None = None,
    style: str | None = None,
    active_border_style: str | None = None,
    inactive_border_style: str | None = None,
    message: str | None = None,
    keep: bool | None = None,
) -> Pane
```

Create a floating :class:`Pane` in this window ([`$ tmux new-pane`](/en/tmux/latest/manual/new-pane/)).

Use :meth:`split` for a tiled pane. Floating panes require tmux 3.7+;
delegates to :meth:`Pane.new_pane` on the active pane.

## Examples

```python
>>> from libtmux.common import has_gte_version
>>> if has_gte_version("3.7"):
...     floating = window.new_pane(width=40, height=10, shell="sleep 5")
...     is_floating = floating.pane_floating_flag
... else:
...     is_floating = "1"
>>> is_floating
'1'
```

## Parameters

- `target` (`int | str | None`): Custom *target-pane*.
- `start_directory` (`StrPath | None`): Working directory for the new pane (``-c``).
- `attach` (`bool`): Make the new pane active, default False (``-d`` otherwise).
- `shell` (`str | None`): Command to run; the pane closes when it exits.
- `environment` (`dict[str, str] | None`): Environment variables for the new pane (``-e``).
- `width` (`int | None`): Width in cells (``-x``).
- `height` (`int | None`): Height in cells (``-y``).
- `x` (`int | None`): X position in cells (``-X``).
- `y` (`int | None`): Y position in cells (``-Y``).
- `zoom` (`bool | None`): Zoom the pane (``-Z``).
- `empty` (`bool | None`): Create an empty pane with no command (``-E``).
- `style` (`str | None`): Style for the floating pane (``-s``).
- `active_border_style` (`str | None`): Border style when the pane is active (``-S``).
- `inactive_border_style` (`str | None`): Border style when the pane is inactive (``-R``).
- `message` (`str | None`): Keep the pane open (until a key is pressed) after the command
exits, showing this ``remain-on-exit-format`` message (``-m``).
- `keep` (`bool | None`): Keep the pane open until a key is pressed after exit (``-k``),
using the default ``remain-on-exit-format``.

## Returns

:class:`Pane`
    The newly created floating pane.
