# libtmux.Window.kill

- **Module:** libtmux.Window
- **Package:** libtmux
- **Language:** Python
- **Kind:** method
- **Source:** https://github.com/tmux-python/libtmux/blob/036c521c4b83ce6e434eb50afe2a0d08a6a05e46/src/libtmux/window.py#L1399
- **Page:** https://libtmux.org/reference/py/libtmux-window-kill/

```
libtmux.Window.kill(self, all_except: bool | None = None) -> None
```

Kill :class:`Window`.

``$ tmux kill-window``.

## Example

Kill a window:

```python
>>> window_1 = session.new_window()
```

## Example

```python
>>> window_1 in session.windows
True
```

## Example

```python
>>> window_1.kill()
```

## Example

```python
>>> window_1 not in session.windows
True
```

## Example

Kill all windows except the current one:

```python
>>> one_window_to_rule_them_all = session.new_window()
```

## Example

```python
>>> other_windows = session.new_window(
...     ), session.new_window()
```

## Example

```python
>>> all([w in session.windows for w in other_windows])
True
```

## Example

```python
>>> one_window_to_rule_them_all.kill(all_except=True)
```

## Example

```python
>>> all([w not in session.windows for w in other_windows])
True
```

## Example

```python
>>> one_window_to_rule_them_all in session.windows
True
```
