---
name: "SetVisual"
section: "2"
platform: "linux"
package: "perl-tk"
version: "b11.02-5"
release: "Debian 1.3 (Bo)"
platforms: ["linux"]
url: "https://new.carta.tech/SetVisual"
---

# SetVisual(2)

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

Token for window. New visual type to use for *tkwin*. Number of bits per pixel desired for *tkwin*. 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 doesn't 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
