---
name: "MainLoop"
section: "3tk"
platform: "linux"
package: "tk8.3-doc"
version: "8.3.5-14"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/MainLoop/3tk"
---

# MainLoop(3tk)

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
