wm attributes
Gives or sets the attributes of a toplevel that depend on the platform.
wm attributes WINDOW
wm attributes WINDOW OPTION
wm attributes WINDOW OPTION VALUE ?OPTION VALUE ...?
Description
With no OPTION, gives each attribute and its value. With one OPTION, gives its value. With pairs, sets them. The attributes are the attributes of Tk on X11 and two of ztk, -orientation and -zoom.
Options
| Option | Type | Default | Description |
|---|---|---|---|
-alpha | number | 1.0 | The opacity of the window, from 0.0 to 1.0. |
-fullscreen | boolean | 0 | Shows the window on the whole screen with no title bar. |
-orientation | orientation | any | The orientation of the screen that the app asks for on a phone. |
-topmost | boolean | 0 | Keeps the window above the other windows. |
-type | list | empty | A list of window types of X11 for the window manager, such as dialog. |
-zoom | number | 1.0 | The scale of the content of the window, from 0.25 to 8. |
-zoomed | boolean | 0 | Maximizes the window. |
-alpha FRACTION
The opacity of the window, from 0.0 to 1.0.
ztk stores the value with no check and with no effect on the window.
% toplevel .a
> wm attributes .a -alpha 0.5
> wm attributes .a -alpha
0.5ztk stores each value with no check.
-fullscreen BOOLEAN
Shows the window on the whole screen with no title bar.
A backend with a full screen state gives the window the whole screen. The headless backend stores the value.
% toplevel .fs
> wm attributes .fs -fullscreen 1
> wm attributes .fs -fullscreen
1% toplevel .fs2
> wm attributes .fs2 -fullscreen x
expected boolean value but got "x"
-errorcode NONE-orientation ORIENTATION
The orientation of the screen that the app asks for on a phone.
portrait and landscape ask the platform to keep the screen in that orientation, and any lets the screen turn. A desktop backend stores the value.
Values: any, landscape, portrait.
% toplevel .or
> wm attributes .or -orientation portrait
> wm attributes .or -orientation
portrait% toplevel .or2
> wm attributes .or2 -orientation up
bad orientation "up": must be any, landscape, or portrait
-errorcode NONE-topmost BOOLEAN
Keeps the window above the other windows.
A backend that can keep a window on top does so while the value is 1.
% toplevel .tm
> wm attributes .tm -topmost 1
> wm attributes .tm -topmost
1% toplevel .tm2
> wm attributes .tm2 -topmost x
expected boolean value but got "x"
-errorcode NONE-type TYPES
A list of window types of X11 for the window manager, such as dialog.
ztk stores the list.
% toplevel .ty
> wm attributes .ty -type {dialog utility}
> wm attributes .ty -type
dialog utilityztk stores each value with no check.
-zoom FACTOR
The scale of the content of the window, from 0.25 to 8.
A factor of ztk for the size of the widgets of the window, such as 2 for twice the size.
% toplevel .zm
> wm attributes .zm -zoom 2
> wm attributes .zm -zoom
2% toplevel .zm2
> wm attributes .zm2 -zoom 9
bad zoom "9": must be from 0.25 to 8
-errorcode NONE
% toplevel .zm3
> wm attributes .zm3 -zoom x
expected floating-point number but got "x"
-errorcode NONE-zoomed BOOLEAN
Maximizes the window.
A backend with the zoomed state maximizes the window while the value is 1. ztk stores the value with no check.
% toplevel .zd
> wm attributes .zd -zoomed 1
> wm attributes .zd -zoomed
1ztk stores each value with no check.
Returns
A list of attributes and values, one value, or an empty string.
Examples
% toplevel .t
> wm attributes .t
-alpha 1.0 -topmost 0 -zoomed 0 -fullscreen 0 -type {} -orientation any -zoom 1.0
Errors
% wm attributes .t -bogus
bad attribute "-bogus": must be -alpha, -topmost, -zoomed, -fullscreen, -type, -orientation, or -zoom
-errorcode NONE
% wm attributes .t -alpha 0.5 -topmost
wrong # args: should be "wm attributes window ?-option value ...?"
-errorcode NONE
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.1