beetlebug▾
/

ttk::sizegrip

Makes a themed size grip: a handle in the corner of a window that the user drags to resize the window.

ttk::sizegrip PATHNAME ?OPTION VALUE ...?

Description

Makes a themed size grip with the name PATHNAME and the options of the call, and makes the command PATHNAME for the widget commands below. The grip draws three rows of dots. A drag of the grip changes the width and the height of its toplevel with wm geometry.

Put the grip in the bottom right corner of the toplevel, such as with grid -sticky se in the last row and column. The grip asks for 16 by 16 logical pixels, and its default cursor is bottom_right_corner.

The parent of PATHNAME must exist, and PATHNAME must not. The class of the grip is TSizegrip, the name of its style.

Widget commands

CommandDescription
ttk::sizegrip stateGives the state flags of the widget, or turns flags on and off.
ttk::sizegrip instateTests the state flags of the widget, and runs a script when they match.
ttk::sizegrip identifyGives the name of the element of the widget at a point.
ttk::sizegrip cgetGives the value of an option of the widget.
ttk::sizegrip configureGives or sets the options of the widget.

Options

OptionTypeDefaultDatabase nameDescription
-classclass nameemptyThe class of the widget for the option database and for the bindings, set only at creation.
-cursorcursor nameemptycursorThe shape of the pointer over the widget.
-stylestyle nameemptystyleThe style of the widget, such as TSizegrip or a style of the script such as Accent.TSizegrip.
-takefocusboolean, empty, or scriptemptytakeFocusWhether the Tab key can move the focus to the widget.

-class CLASS

The class of the widget for the option database and for the bindings, set only at creation.

The class name replaces the class of the style, such as TSizegrip, in winfo class and in the bind tags of the widget. Give it in the call that makes the widget. A later configure of the option gives an error.

% ttk::sizegrip .tsgcl -class Fancy
> winfo class .tsgcl
Fancy

% ttk::sizegrip .tsgcl3
> winfo class .tsgcl3
TSizegrip
% ttk::sizegrip .tsgcl2
> .tsgcl2 configure -class Other
attempt to change read-only option
-errorcode NONE

-cursor CURSOR

The shape of the pointer over the widget.

A cursor name of Tk, such as hand2 or xterm. An empty value uses the cursor of the parent.

% ttk::sizegrip .tsgcu -cursor hand2
> .tsgcu cget -cursor
hand2

ztk stores each value of the option with no check.

-style STYLE

The style of the widget, such as TSizegrip or a style of the script such as Accent.TSizegrip.

An empty value uses the style TSizegrip. A style name of the script ends with the name of the base style, such as Accent.TSizegrip, and ttk::style configure and ttk::style map give it its options. A style with no settings looks like its base style.

% ttk::style configure Accent.TSizegrip -foreground white
> ttk::sizegrip .tsgsy -style Accent.TSizegrip
> .tsgsy cget -style
Accent.TSizegrip

ztk stores each value of the option with no check, as Tk 8.6.16 does at creation.

-takefocus VALUE

Whether the Tab key can move the focus to the widget.

1 puts the widget in the order of the Tab key, and 0 leaves it out. The default empty value uses the default rule of Tk, and this widget is not in the order of the Tab key with it. A script runs with the path of the widget appended, and its result is the answer.

% ttk::sizegrip .tsgtf -takefocus 1
> .tsgtf cget -takefocus
1

ztk stores each value of the option with no check.

Returns

PATHNAME.

Examples

% wm geometry . 300x200
> ttk::sizegrip .grip
> pack .grip -side right -anchor se
> update
> event generate .grip <Button-1> -x 2 -y 2 -rootx 100 -rooty 100
> event generate .grip <B1-Motion> -x 22 -y 12 -rootx 120 -rooty 110
> event generate .grip <ButtonRelease-1>
> update
> list [winfo width .] [winfo height .]
320 210

% winfo class [ttk::sizegrip .corner]
TSizegrip

Errors

% ttk::sizegrip .x -orient vertical
unknown option "-orient"
-errorcode TK LOOKUP OPTION -orient

% ttk::sizegrip .twice
> ttk::sizegrip .twice
window name "twice" already exists in parent
-errorcode TK VALUE WINDOW EXISTS

# The parent .no does not exist.
% ttk::sizegrip .no.s
bad window path name ".no"
-errorcode TK LOOKUP WINDOW .no

% ttk::sizegrip
wrong # args: should be "ttk::sizegrip pathName ?-option value ...?"
-errorcode TCL WRONGARGS

Differences from Tcl

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also