blt::tile(3tcl)

πŸ’– blt::tile β€” tiling versions of Tk widgets πŸ’–

okay bestie, so this is blt::tile, a page from the BLT Built-In Commands manual. it's literally about giving your Tk widgets textured backgrounds, and it's lowkey iconic. let's get into it 🫢


✨ NAME ✨

tile β€” tiling versions of Tk widgets. yes that's the whole vibe. πŸ’…


🌸 SYNOPSIS 🌸

tile::button pathName option value...

tile::checkbutton pathName option value...

tile::frame pathName option value...

tile::label pathName option value...

tile::radiobutton pathName option value...

tile::scrollbar pathName option value...

tile::toplevel pathName option value...

πŸŽ€ DESCRIPTION πŸŽ€

so the tile widgets let you create textured backgrounds, which is giving main character energy fr fr. the texture is a Tk image, and it gets tiled over the entire background of the widget. πŸ¦‹

the offset of the tile usually aligns with the toplevel window, so that all the sub-tiles line up and nothing looks cursed. however β€” and this is the important bit β€” image names containing an exclamation mark "!" (usually as the last char) are tiled absolutely. no cap. ⚠️


πŸ’œ INTRODUCTION πŸ’œ

with the advent of Tk 4.0, images are now easy to create and use in applications. images add interest to applications and they convey more information. but one area where Tk hasn't taken advantage of images is using images as textures for widgets. since tiling is a standard feature of windowing systems, it's very easy to use images as textures. slay. ✨

note: Wize now adds a -tile option to Tk widgets natively. however, these are retained to provide the -shadow option. so don't come for them, they're still here for a reason πŸ’–

tiled widgets take the standard Tk 4.0 widgets and add tiling configuration options to them. textures are specified by the name of the image you wish to be tiled across the background of the widget. periodt. πŸ‘‘


🌈 EXAMPLE 🌈

to add tiling to a widget, you simply create an image using Tk's image command and use the image name as the value for the -tile configuration option of the widget. it's giving effortless. 🧚

image create photo my_texture -file tan_paper.gif
blt::tile::frame .f -tile my_texture

the image my_texture is added to the frame. and bestie, if my_texture is updated, so will the widget background. live updates?? obsessed. 😭

image create photo my_texture -file rain.gif

the tile widget commands reside in the "blt::tile" namespace, so as not to collide with the normal Tk widgets. an easy way to add tiling to existing programs is to import the tile widget commands into the global namespace. πŸ’«

image create photo my_texture -file tan_paper.gif
namespace import -force blt::tile::*
frame .f -tile my_texture

to use one image for all texturing, you can use the "Tile" option class name to specify the same image for all tile widgets. one image, every widget, that's the dream fr fr 🌸

image create photo my_texture -file tan_paper.gif
option add *Tile my_texture

πŸ’… OPTIONS πŸ’…

the following configurations options are added to the widgets. if a -tile or -activetile option is specified, it overrides the background color of the widget. (yes, it wins. no arguments. πŸ‘‘)

  • -activetile image β€” specifies a textured background to display when the widget is active. this option is available for the tilebutton, tilecheckbutton, tileradiobutton, and tilescrollbar widgets. image is the name an image created using Tk's image command. the background of the widget is tiled with image. if image is "", then the active background color is displayed. the default is "".
  • -tile image β€” specifies a textured background to display for the widget. image is the name an image created using Tk's image command. the background of the widget is tiled with image. if image is "", then the normal background color is displayed. the default is "".
  • -shadow shadow β€” set shadow for text.
  • -rotate degrees β€” support for rotating text in degrees, eg. 90, 180.
  • -checksize num β€” specify the size of check/radio button indicator.
  • -icons images β€” give a list of 0, or 2-9 images to use for the indicators. the first three are for normal,selected,tristate. the next three repeat but for the active state. the next three repeat but for the disabled state.
  • -bdimage image β€” a border image that resizes to fit the widget.
  • -activebdimage image β€” a border image that resizes to fit the widget.
  • -disabledbdimage image β€” a border image that resizes to fit the widget.
  • -bdflags int β€” set to -1 to perform inner rather than outer mirror.

πŸ”₯ KEYWORDS πŸ”₯

tile, texture, button, label, radiobutton, checkbutton, scrollbar, frame, toplevel


and that's the whole page bestie, you ate that πŸ’– this was BLT 2.5, blt::tile(3tcl) β€” go forth and tile your widgets, mwah πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from