bell
Guide: Frames, labels, and buttons
Rings the bell of the display: in ztk, the command checks its options and makes no sound.
bell ?-displayof WINDOW? ?-nice?
Description
In Tk, bell makes the sound of the display, such as a short beep, to tell the user about a bad key or a bad value. ztk has no sound, so bell makes no sound and shows no change. A script can call bell with no test of the platform.
The command checks that each word is -displayof or -nice. It does not check the window of -displayof.
Options
| Option | Type | Default | Description |
|---|---|---|---|
-displayof | window | none | The window whose display rings the bell. |
-nice | flag | none | Rings the bell with no reset of the screen saver. |
-displayof WINDOW
The window whose display rings the bell.
In Tk, the bell rings on the display of WINDOW. ztk has one display for each app, so the value has no effect. ztk does not check that WINDOW exists.
% bell -displayof .ztk accepts any value of -displayof.
-nice
Rings the bell with no reset of the screen saver.
In Tk on X11, a bell also resets the screen saver, and -nice leaves the screen saver as it is. ztk makes no sound and does not touch the screen saver, so the flag has no effect.
% bell -niceThe flag has no value, and a call with it does not fail.
Returns
An empty string.
Examples
% bell
# A binding that rings the bell on a key the entry does not use.
% entry .e
> bind .e <Key-Escape> {bell}
> bind .e <Key-Escape>
bell
Errors
% bell -foo
bad option "-foo": must be -displayof or -nice
-errorcode NONE
% bell now
bad option "now": must be -displayof or -nice
-errorcode NONE
Differences from Tcl
bellmakes no sound and shows no change. In Tk 8.6.16 on X11 it rings the bell of the display.bell -displayof .nopegives an empty string, andbell -displayofwith no window gives an empty string. Tk 8.6.16 gives the errorbad window path name ".nope"for the first and a wrong # args error for the second.- The error of a bad option has the
-errorcodeNONE. Tk 8.6.16 givesTCL LOOKUP INDEX optionand the bad word.
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.1