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:

  • activeBackground
  • background
  • borderWidth
  • cursor
  • foreground
  • highlightBackground
  • highlightColor
  • highlightThickness
  • insertBackground
  • insertBorderWidth
  • insertOffTime
  • insertOnTime
  • insertWidth
  • relief
  • repeatDelay
  • repeatInterval
  • selectBackground
  • selectBorderWidth
  • selectForeground
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 cget option β€” returns the current value of the configuration option given by option. option may have any of the values accepted by the iwidgets::canvasprintbox command.
  • 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, 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 the iwidgets::canvasprintbox command.
  • pathName getoutput β€” returns the value of the printercmd or filename option depending on the current setting of output.
  • 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 the stamp accordingly. useful for Apply-buttons. ✨
  • pathName setcanvas canvas β€” 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