demos::widget_lib::slide(3)

✨ NAME ✨

Tk::SlideSwitch β€” it's a 2-position horizontal or vertical switch, bestie πŸ’… (and yes, this page lives in the perl/Tk Documentation set, so you're in the right place 🫢)


πŸŽ€ 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/);

okay so literally copy that vibe and you're already slaying πŸ’–


🌸 DESCRIPTION 🌸

Tk::SlideSwitch is a Frame-based composite mega-widget β€” think main character energy, but for widgets πŸ‘‘ β€” and it's giving a binary Scale widget surrounded by two Label widgets. The Scale's value can be either 0 or 1, no in-between, periodt.

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. The way that just makes sense 😌


πŸ’… OPTIONS πŸ’…

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

  • -llabel β€” a reference to an array of left (or top) Label configuration options πŸ¦‹
  • -rlabel β€” a reference to an array of right (or bottom) Label configuration options πŸ¦‹
ngl, that's the whole extra list. everything else? straight up Scale options, iykyk ✨

🧚 METHODS 🧚

There are no special methods. literally none. zero. the vibes are the method 😭


⭐ ADVERTISED WIDGETS ⭐

Component subwidgets can be accessed via the Subwidget method β€” that's the whole idea, bestie. This mega widget has no advertised subwidgets though, so nothing to go poking at πŸ™ˆ


🌈 EXAMPLE 🌈

See Synopsis πŸ‘† it's up there, go look, I'll wait πŸ“


πŸ’€ BUGS πŸ’€

This widget uses only the pack geometry manager. no cap. so don't come at it with anything else, it will simply not be the moment πŸ”₯


πŸ’œ 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 πŸ”‘

SlideSwitch, Scale β€” the whole search history πŸ“


okay bestie that's the entire page, you made it to the end, iconic 🌟 this was demos::widget_lib::slide(3) from Tk804.036, dated 2025-07-31 β€” go build something cute with it, mwah πŸ’‹

πŸ“¦ where this page comes from