---
name: "Tk_SetWindowVisual"
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_SetWindowVisual"
---

# Tk\_SetWindowVisual(3)

change visual characteristics of window

```

```

## NAME

Tk\_SetWindowVisual - change visual characteristics of window

## SYNOPSIS

```
#include <tk.h>

int
Tk_SetWindowVisual(tkwin, visual, depth, colormap)
```

## ARGUMENTS

- Tk\_Window *tkwin* (in)

  Token for window.

- Visual *\*visual* (in)

  New visual type to use for *tkwin*.

- int *depth* (in)

  Number of bits per pixel desired for *tkwin*.

- Colormap *colormap* (in)

  New colormap for *tkwin*, which must be compatible with *visual* and *depth*.

  ```

  ```

## DESCRIPTION

When Tk creates a new window it assigns it the default visual characteristics (visual, depth, and colormap) for its screen. **Tk\_SetWindowVisual** may be called to change them. **Tk\_SetWindowVisual** must be called before the window has actually been created in X (e.g. before **Tk\_MapWindow** or **Tk\_MakeWindowExist** has been invoked for the window). The safest thing is to call **Tk\_SetWindowVisual** immediately after calling **Tk\_CreateWindow**. If *tkwin* has already been created before **Tk\_SetWindowVisual** is called then it returns 0 and does not make any changes;  otherwise it returns 1 to signify that the operation completed successfully.

Note:  **Tk\_SetWindowVisual** should not be called if you just want to change a window's colormap without changing its visual or depth; call **Tk\_SetWindowColormap** instead.

## KEYWORDS

colormap, depth, visual
