iwidgets::scrolledhtml(1)
β¨ NAME β¨
iwidgets::scrolledhtml β okay so bestie, this is the iwidgets::scrolledhtml(1) page from [incr Widgets], and what it does is create and manipulate a scrolled text widget that has the extra capability of displaying HTML formatted documents. π
It's giving text widget but make it fashion.
πΈ SYNOPSIS πΈ
iwidgets::scrolledhtml pathName ?options?
π¦ INHERITANCE π¦
The family tree, and she has main character energy at the bottom:
itk::Widget <- iwidgets::Labeledwidget <- iwidgets::Scrolledtext <- iwidgets::Scrolledhtml
π STANDARD OPTIONS π
Here's the whole standard squad: activeBackground, background, borderWidth, cursor, exportSelection, foreground, highlightColor, highlightThickness, insertBackground, insertBorderWidth, insertOffTime, insertOnTime, insertWidth, padX, padY, relief, repeatDelay, repeatInterval, selectBackground, selectBorderWidth, selectForeground, setGrid.
Ngl, if you wanna know what all of these actually do, go read the options manual entry. It's all there, iykyk.
π ASSOCIATED OPTIONS π
Scrollbar-flavored ones: activeRelief, elementBorderWidth, jumptroughColor.
Check the scrollbar widget manual entry for the tea on those. β
Text-flavored ones: spacing1, spacing2, spacing3, state, tabs, wrap.
Check the text widget manual entry for the details on those ones. π
π§ INHERITED OPTIONS π§
Coming down from the scrolledtext class: labelBitmap, labelFont, labelImage, labelMargin, labelPos, labelText, labelVariable, height, hscrollMode, sbWidth, scrollMargin, visibleitems, vscrollMode, width.
Go peek at the scrolledtext class manual entry for the full explanation of all that. π
And one more: sticky.
That one comes from the labeledwidget class manual entry, so look there for the deets. β¨
π WIDGET-SPECIFIC OPTIONS π
This is the part where she really shines, fr fr.
-feedbackβ Name:feedback, Class:FeedBack. This one is the callback command you use to get feedback on the current status. It runs in the formcommand <number of characters remaining>. So yeah, it literally tells you how many characters are left. π«Ά-fixedfontβ Name:fixedfont, Class:FixedFont. The name of the font used for fixed-width character text β think<pre>...</pre>or<tt>...</tt>. The size, style, and other font attributes come from the format tags in the document itself. Default iscourier. π₯οΈ-fontnameβ Name:fontname, Class:FontName. The name of the font for normal-width character spaced text. Same deal: size, style, and other font attributes are decided by the format tags in the document. Default istimes. π-fontsizeβ Name:fontsize, Class:FontSize. The general size of the fonts in use. Pick one ofsmall,medium,large, orhuge. Default ismedium. π-foregroundβ Name:foreground, Class:Foreground. The color of text that is not hypertext links, in any of the forms acceptable toTk_GetColor. Heads up: a particular document can override this with thetextattribute of the Body HTML tag. π¨-linkβ Name:link, Class:Link. The default color of hypertext links, in any of the forms acceptable toTk_GetColor. A particular document may override it with thelinkattribute of the Body HTML tag. Default isblue. π΅-linkcommandβ Name:linkcommand, Class:LinkCommand. The command that runs when the user clicks a hypertext link. It executes in the formlinkcommand href, wherehrefis the value given in thehrefattribute of theAHTML tag. π±οΈ-alinkβ Name:alink, Class:alink. The color of hypertext links when the cursor is over the link, in any of the forms acceptable toTk_GetColor. Default isred. π΄-textbackgroundβ Name:textBackground, Class:Background. The background color for the text area, in any of the forms acceptable toTk_GetColor. A particular document can override this one with thebgcolorattribute of the Body HTML tag. π-unknownimageβ Name:unknownimage, Class:UnknownImage. The name of the image file to display when animgspecified in the html document just... won't load. π-alinkβ Name:update, Class:Update. (Yes, the Command-Line Switch really is listed as-alinkin the original β not me, bestie.) A boolean value indicating whether to callupdateduring html rendering.
π DESCRIPTION π
The iwidgets::scrolledhtml command creates a scrolled text widget, but with the extra glow-up of being able to display html formatted documents. β¨ There's an import method to read an html document file, and a render method to display an html formatted text string. Obsessed.
π METHODS π
The iwidgets::scrolledhtml command creates a brand new Tcl command whose name is pathName. That command is what you use to invoke all sorts of operations on the widget. The general form is:
pathName option ?arg arg ...?
Option and the args decide the exact behavior of the command. Here are the commands possible for scrolledhtml widgets: π
π¦ ASSOCIATED METHODS π¦
bbox, compare, debug, delete, dlineinfo, get, index, insert, mark, scan, search, see, tag, window, xview, yview.
See the text manual entry for the details on these standard methods. π
πΈ INHERITED METHODS πΈ
export, clear.
See the scrolledhtml manual entry for details on the inherited methods. π
π WIDGET-SPECIFIC METHODS π
pathName cget option
Returns the current value of the configuration option given by option. Option may have any of the values accepted by the iwidgets::scrolledhtml command. Simple as that. β¨
pathName configure ?option? ?value option value ...?
Query or modify the configuration options of the widget. If no option is specified, it returns a list describing all of the available options for pathName (see Tk_ConfigureInfo for info on the format of this list). If option is specified with no value, the command returns a list describing that one named option β and that list will be identical to the corresponding sublist of the value returned when no option is specified. If one or more option-value pairs are specified, the command modifies the given widget option(s) to have the given value(s); in that case the command returns an empty string. Option may have any of the values accepted by the iwidgets::scrolledhtml command. π οΈ
pathName import ?option? href
Load html formatted text from a file. Href must exist β no vibe-checking, it has to be real. If option is -link, href is assumed to be relative to the application's current working directory. Otherwise, href is assumed to be relative to the path of the last page loaded. Href is either a filename, or a reference of the form filename#anchorname. In that latter form, fIFilename and/or anchorname may be empty. If filename is empty, the current document is assumed. If anchorname is empty, the top of the document is assumed. π
pathName pwd
Print the current working directory of the widget, i.e. the directory of the last page loaded. π
pathName render htmltext ?wd?
Display HTML formatted text htmltext. Wd gives the base path to use for all links and images in the document. Wd defaults to the application's current working directory. π¨
pathName title
Return the title of the current page, as given in the <title>...</title> field in the document. π·οΈ
π HTML COMPLIANCE π
This widget is compliant with HTML 3.2, with the following exceptions (she's not perfect, nobody is):
- No features requiring a connection to an http server are supported. π
- Some image alignments aren't supported, because they are not supported by the text widget.
- The
<br>attributes dealing with image alignments aren't supported. - Automatic table sizing is not supported very well, due to limitations of the text widget. π
π₯ EXAMPLE π₯
Here's the moment you've been waiting for:
package require Iwidgets 4.0
option add *textBackground white
iwidgets::scrolledhtml .sh -fontname helvetica -linkcommand "this import -link"
pack .sh -padx 10 -pady 10 -fill both -expand yes
.sh import ~/public_html/index.html
Ate. Periodt. π
π BUGS π
Cells in a table can be caused to overlap. Ex:
<table border width="100%">
<tr><td>cell1</td><td align=right rowspan=2>cell2</td></tr>
<tr><td colspan=2>cell3 w/ overlap</td>
</table>
It hasn't been fixed because 1) it's a pain to fix, 2) it will slow tables down by a significant amount, and 3) netscape has the same bug, as of V3.01. So like... it's a whole thing. π
π«Ά ACKNOWLEDGEMENTS π«Ά
Sam Shen β this code is based largely on his tkhtml.tcl code from tk inspect. Tkhtml is copyright 1995 Lawrence Berkeley Laboratory. Giving credit where credit is due, always. π
π AUTHOR π
Kris Raney
β KEYWORDS β
scrolledhtml, html, text, widget
And that's the whole page, bestie! π This one comes to you from Tk (that's the source/version chilling in the footer) and from the [incr Widgets] crew β iwidgets::scrolledhtml(1), no cap. Go build something iconic with it. πβ¨π¦
π¦ where this page comes from
- debian bookworm: iwidgets4-doc 4.1.1-2.1
- debian trixie: iwidgets4-doc 4.1.1-4
- ubuntu jammy: iwidgets4-doc 4.1.1-2.1
- ubuntu noble: iwidgets4-doc 4.1.1-2.1
- ubuntu resolute: iwidgets4-doc 4.1.1-4
- ubuntu stonking: iwidgets4-doc 4.1.1-4
- Copyright (c) 1996 DSC Technologies Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms