---
name: "Tk_MainLoop"
section: "3"
platform: "linux"
package: "tk"
version: "8.6.16-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Tk_MainLoop"
---

# Tk\_MainLoop(3)

loop for events until all windows are deleted

```

```

## NAME

Tk\_MainLoop - loop for events until all windows are deleted

## SYNOPSIS

```
#include <tk.h>

Tk_MainLoop()
```

## DESCRIPTION

**Tk\_MainLoop** is a procedure that loops repeatedly calling **Tcl\_DoOneEvent**.  It returns only when there are no applications left in this process (i.e. no main windows exist anymore).  Most windowing applications will call **Tk\_MainLoop** after initialization; the main execution of the application will consist entirely of callbacks invoked via **Tcl\_DoOneEvent**.

## KEYWORDS

application, event, main loop
