iwidgets::extbutton(1)

πŸ’– iwidgets::extbutton β€” the manual, but make it make sense πŸ’–

okay bestie, welcome to iwidgets::extbutton, a page from the [incr Widgets] manual set. it's a Tk button that leveled up, fr fr. let's get into it 🌸


✨ NAME ✨

iwidgets::extbutton β€” it extends the behavior of the Tk button by letting a bitmap or an image coexist with text. yes, both. at the same time. iconic πŸ’…


🌈 SYNOPSIS 🌈

iwidgets::extbutton pathName ?options?

πŸ¦‹ INHERITANCE πŸ¦‹

itk::Widget <- iwidgets::Extbutton

so it's giving itk::Widget, and iwidgets::Extbutton is the main character downstream of it πŸ‘‘


⭐ STANDARD OPTIONS ⭐

these are the classics, the standard-issue ones:

  • activebackground
  • activeforeground
  • bitmap
  • background
  • bd
  • cursor
  • disabledforeground
  • font
  • foreground
  • image
  • justify
  • relief
  • text
heads up bestie: go read the "options" manual entry for the details on all of these standard options. that's where the lore lives πŸ“–

πŸŽ€ WIDGET-SPECIFIC OPTIONS πŸŽ€

these are the options that make this widget this widget. no cap.

  • -bitmapforeground β€” Name: bitmapforeground, Class: Foreground, Command-Line Switch: -bitmapforeground. Configures the foreground color of the bitmap. that's it, that's the job πŸ’œ
  • -command β€” Name: command, Class: Command, Command-Line Switch: -command. Associate a command with the extbutton. it simulates a Tk button's -command option. it gets invoked by either <1> events or by explicitly calling the public invoke() method. your call, bestie 🫢
  • -defaultring β€” Name: defaultring, Class: DefaultRing, Command-Line Switch: -defaultring. A boolean describing whether the extbutton displays its default ring, given in any of the forms acceptable to Tcl_GetBoolean. the default is false. periodt.
  • -defaultringpad β€” Name: defaultringpad, Class: Pad, Command-Line Switch: -defaultringpad. Specifies the amount of space to be allocated to the indentation of the default ring, given in any of the forms acceptable to Tcl_GetPixels. ⚠️ this option has no effect if the defaultring option is set to false. the default is 4 pixels.
  • -imagepos β€” Name: imagePos, Class: Position, Command-Line Switch: -imagepos. Specifies the image position relative to the message text: n, ne, nw, s, se, sw, w, wn, ws, e, en, or es. the default is w. lowkey a whole compass up in here 🧭
  • -ringbackground β€” Name: ringBackground, Class: Background, Command-Line Switch: -ringbackground. Configures the background color of the default ring frame (if -defaultring is set to boolean true). ✨

πŸ’« DESCRIPTION πŸ’«

The extbutton extends the behavior of the atomic Tk button by allowing text and an image or bitmap to coexist. yep, coexist. they're roommates, they get along 🀝

You can use the -image or -bitmap options to specify an image, plus the -imagepos option to specify where that image sits relative to the text.

🚨 real talk: the extbutton is not intended to be used without an image/bitmap. There will be an empty space next to the text if no image/bitmap is specified. (yes, the original says "emtpy" β€” we keep it real here. no image = no image, just vibes and a gap πŸ’€)

πŸͺ„ METHODS πŸͺ„

The iwidgets::extbutton command creates a new Tcl command whose name is pathName. This command may be used to invoke various operations on the widget.

It has the following general form:

pathName option ?arg arg ...?

🌸 INHERITED METHODS 🌸

Each of the following methods are inherited from itk::Archetype. Go read that man page for the details, bestie:

  • pathName cget
  • pathName component
  • pathName config
  • pathName configure

πŸ‘‘ WIDGET-SPECIFIC METHODS πŸ‘‘

  • pathName invoke β€” Evaluates the command fragment associated with the -command option. πŸ’₯
  • pathName flash β€” Simulates the Tk button's flash command. ⚑

πŸ”₯ EXAMPLES πŸ”₯

okay, this is the part where it all comes together. look at her go:

package require Iwidgets 4.0 iwidgets::extbutton .eb -text "Bitmap
example" -bitmap info \
  -background bisque -activeforeground red -bitmapforeground blue \
  -defaultring 1 -command {puts "Bisque is beautiful"} pack .eb -expand
1

and the glow-up version with an actual image:

iwidgets::extbutton .eb -text "Image example" -relief ridge -image \
  [image create photo -file
$itk::library/../iwidgets/demos/images/clear.gif] \
  -font 9x15bold -background lightgreen -imagepos e \
  -activebackground lightyellow pack .eb -expand 1

"Bisque is beautiful" β€” honestly? a mood. 🌈


πŸ’œ AUTHOR πŸ’œ

Chad Smith πŸ‘‘


🌟 KEYWORDS 🌟

button, pushbutton


and that's the whole page, bestie!! this one ships out of the Tk manual set, part of [incr Widgets] β€” iwidgets::extbutton(1), and it lives right there in the Tk family. go forth and make pretty buttons with text and images, you absolute icon πŸŽ€πŸ’–βœ¨

πŸ“¦ where this page comes from