demos::widget\_lib::slide(3) perl/Tk Documentation demos::widget\_lib::slide(3)

# [NAME](#NAME)

Tk::SlideSwitch - a 2 position horizontal or vertical switch.

# [SYNOPSIS](#SYNOPSIS)

```
 use Tk::SlideSwitch;
 my $sl = $frame1->SlideSwitch(
     -bg          => 'gray',
     -orient      => 'horizontal',
     -command     => [$self => 'on'],
     -llabel      => [-text => 'OFF', -foreground => 'blue'],
     -rlabel      => [-text => 'ON',  -foreground => 'blue'],
     -troughcolor => 'tan',
 )->pack(qw/-side left -expand 1/);
```

# [DESCRIPTION](#DESCRIPTION)

Tk::SlideSwitch is a Frame based composite mega-widget featuring a binary Scale widget surrounded by two Label widgets. The Scale's value can be either 0 or 1. The Labels are positioned to the left and right of the Scale if its orientation is horizontal, else on the top and bottom of the Scale.

# [OPTIONS](#OPTIONS)

In addition to all Scale options, the following option/value pairs are also supported:

[**-llabel**](#llabel)

A reference to an array of left (or top) Label configuration options.

[**-rlabel**](#rlabel)

A reference to an array of right (or bottom) Label configuration options.

# [METHODS](#METHODS)

There are no special methods.

# [ADVERTISED WIDGETS](#ADVERTISED_WIDGETS)

Component subwidgets can be accessed via the **Subwidget** method. This mega widget has no advertised subwidgets.

# [EXAMPLE](#EXAMPLE)

See Synopsis.

# [BUGS](#BUGS)

This widget uses only the pack geometry manager.

# [AUTHOR](#AUTHOR)

sol0@Lehigh.EDU

Copyright (C) 2002 - 2003, Steve Lidie. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

# [KEYWORDS](#KEYWORDS)

SlideSwitch, Scale

2026-08-31 Tk804.036

---

Document: Tk::demos::widget_lib::slide(3pm) from perl-tk 804.036-r11 (Chainguard OS)
Source: https://github.com/eserte/perl-tk
