iwidgets::canvasprintbox(1)
β¨ iwidgets::canvasprintbox β¨
okay bestie, we're in the [incr Widgets] section of the manual, page iwidgets::canvasprintbox(1), and this one is genuinely a whole vibe β it's the print box. like, for canvases. π
πΈ NAME πΈ
iwidgets::canvasprintbox β create and manipulate a canvas print box widget. that's it, that's the job. it makes the thing, you play with the thing. π
π¦ SYNOPSIS π¦
iwidgets::canvasprintbox pathName ?options?
π INHERITANCE π
itk::Widget <- iwidgets::Canvasprintbox
so it's an itk::Widget that became a iwidgets::Canvasprintbox. glow up fr. β
β¨ STANDARD OPTIONS β¨
these are the ones you get from the family, no extra charge:
activeBackgroundbackgroundborderWidthcursorforegroundhighlightBackgroundhighlightColorhighlightThicknessinsertBackgroundinsertBorderWidthinsertOffTimeinsertOnTimeinsertWidthreliefrepeatDelayrepeatIntervalselectBackgroundselectBorderWidthselectForeground
lowkey important: go read the options manual entry if you want the details on any of the standard options. i'm not gonna re-explain what's already documented elsewhere, that's not the move. π«Ά
π ASSOCIATED OPTIONS π
nothing here bestie. this section is empty in the original. it's giving "reserved for later". π
π WIDGET-SPECIFIC OPTIONS π
okay THIS is the main character section. buckle up. π
-filenameβ Name:filename, Class:FileName, Command-Line Switch:-filename
the file you wanna write the postscript output to. only used when output is set to "file". and here's the lil plot twist: if posterizing is turned on and hpagecnt and/or vpagecnt is more than 1, then x.y gets appended to the filename β where x is the horizontal page number and y is the vertical page number. so your one filename becomes a whole fleet of them. β¨
-hpagecntβ Name:hpagecnt, Class:PageCnt, Command-Line Switch:-hpagecnt
works together with posterize to decide how many pages the output gets spread over. this attribute says how many pages go horizontaly. any change to this attribute automatically updates the "stamp". defaults to 1.
-orientβ Name:orient, Class:Orient, Command-Line Switch:-orient
decides the orientation of the output headed to the printer (or the file). it can be "portrait" or "landscape" (default). changes to this attribute show up immediately in the "stamp". defaults to "landscape", but it'll get changed automaticaly to the value deemed appropiate for the current canvas. and heads up β if you set this attribute when the canvasprintbox is first constructed (instead of using the "configure" method), that turns off the auto adjustment of this attribute. so choose wisely. π
-outputβ Name:output, Class:Output, Command-Line Switch:-output
tells you where the postscript output should go: to the printer or to a file. takes the values "printer" or "file". the corresponding entry-widget mirrors the contents of either the printcmd attribute or the filename attribute. defaults to "printer".
-pagesizeβ Name:pageSize, Class:PageSize, Command-Line Switch:-pagesize
the pagesize the printer supports. changes to this attribute show up immediately in the "stamp". defaults to "a4".
-posterizeβ Name:posterize, Class:Posterize, Command-Line Switch:-posterize
on or off, is posterizing happening. posterizing the output means you can distribute the output over more than one page. this way you can print a canvas/region that's bigger than the specified pagesize without stretching. and if you use it in combination with stretching, you can use it to "blow up" the contents of a canvas to as large a size as you want β see the hpagecnt and vpagecnt attributes. any change to this attribute automatically updates the "stamp". defaults to 0.
-printcmdβ Name:printCmd, Class:PrintCmd, Command-Line Switch:-printcmd
the command to execute when printing the postscript output. the command gets the postscript directed to its standard input. only used when output is set to "printer". defaults to "lpr".
-printregionβ Name:printRegion, Class:PrintRegion, Command-Line Switch:-printregion
a list of four coordinates saying which part of the canvas to print. an empty list means the canvas' entire scrollregion should be printed. any change to this attribute automatically updates the "stamp". defaults to an empty list.
-stretchβ Name:stretch, Class:Stretch, Command-Line Switch:-stretch
decides if the output should be stretched to fill the page (as defined by the pagesize attribute) as large as possible. the aspect-ratio of the output is retained and the output will never fall outside the boundaries of the page. defaults to 0, but it'll get changed automaticaly to the value deemed appropiate for the current canvas. and same tea as orient: setting this attribute when the canvasprintbox is first constructed (instead of using the "configure" method) turns off the auto adjustment of this attribute. π
-vpagecntβ Name:vPageCnt, Class:PageCnt, Command-Line Switch:-vpagecnt
used in combination with "posterize" to figure out how many pages the output should be distributed over. this attribute says how many pages to use verticaly. any change to this attribute automatically updates the "stamp". defaults to 1.
π DESCRIPTION π
it implements a print box for printing the contents of a canvas widget to a printer or a file. you can specify page orientation, how many pages to print the image on, and whether the output should be stretched to fit the page. and yeah, options exist to control the appearance and the actions of the widget. slay. π
π§ METHODS π§
the iwidgets::canvasprintbox command creates a brand new Tcl command whose name is pathName. you can use this command to invoke various operations on the widget. general form, bestie:
pathName option ?arg arg ...?
Option and the args determine the exact behavior of the command. and here are the commands possible for canvasprintbox widgets: β¬οΈ
π WIDGET-SPECIFIC METHODS π
pathName cgetoption β returns the current value of the configuration option given by option. option may have any of the values accepted by theiwidgets::canvasprintboxcommand.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 (seeTk_ConfigureInfofor info on the format of this list). if option is specified with no value, then the command returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). if one or more option-value pairs are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the command returns an empty string. option may have any of the values accepted by theiwidgets::canvasprintboxcommand.pathName getoutputβ returns the value of theprintercmdorfilenameoption depending on the current setting ofoutput.pathName printβ perfrom the actual printing of the canvas using the current settings of all the attributes. returns a boolean indicating wether the printing was successful or not.pathName refreshβ retrieves the current value for all edit fields and updates thestampaccordingly. useful for Apply-buttons. β¨pathName setcanvascanvas β this is used to set the canvas that has to be printed. a stamp-sized copy will automatically be drawn to show how the output would look with the current settings.pathName stopβ stops the drawing of the"stamp". and here's the honest-to-god warning from the original: "I'm currently unable to detect when a Canvasprintbox gets destroyed or withdrawn. It's therefore advised that you perform a stop before you do something like that."
β οΈ bestie listen: do the stop BEFORE you destroy or withdraw the Canvasprintbox. the author can't detect when that happens. this is not a drill. π
π«Ά COMPONENTS π«Ά
prtflentryβ Class:Entry
the prtflentry component is the entry field for user input of the filename or printer command (depending on the value of output).
hpcntβ Class:Entry
the hpcnt component is the entry field for user input of the number of pages to use horizontaly when posterize is turned on.
vpcntβ Class:Entry
the vpcnt component is the entry field for user input of the number of pages to use verticaly when posterize is turned on.
π EXAMPLE π
package require Iwidgets 4.0 iwidgets::canvasprintbox .fsb -orient
landscape -stretch 1 pack .fsb -padx 10 -pady 10 -fill both -expand yes
(yeah it's formatted exactly like the original, i'm not touching it. copy it verbatim, iykyk. π₯)
π AUTHOR π
Tako Schotanus
Tako.Schotanus@bouw.tno.nl
β KEYWORDS β
canvasprintbox, widget
and that's the whole page, periodt. π this one comes to you from the Tk manual collection, it's iwidgets::canvasprintbox(1), and it's the version that lives under [incr Widgets] β stamped and dated exactly as it was, no cap. go print something pretty. πβ¨π¦πΈ
π¦ 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
- (c) 1995 Tako Schotanus
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms