canvas::snap(3tk)
π
canvas::snap β the canvas::snap(3tk) glow-up β¨
okay bestie, sit down, hydrate, and let me tell you about a lil page from the canvas manual section β it's the one called canvas::snap, and it's literally the screenshot button for your canvases π«Ά
πΈ NAME πΈ
canvas::snap β Canvas snapshot to Tk photo image πΈ
Like, it takes a pic of your canvas. Main character energy only.
β¨ SYNOPSIS β¨
package require Tcl 8.5
package require Tk 8.5
package require canvas::snap ?1.0.1?
package require img::window
::canvas::snap pathName
so first you gotta pull in Tcl 8.5 and Tk 8.5 (the bare minimum, no cap), then canvas::snap itself β version 1.0.1 if you're being specific, but the ? marks mean that's optional, she's flexible πββοΈ β and also img::window, don't forget her, she's the one making the window magic happen. Then you call the one command. That's it. That's the whole vibe check.
π DESCRIPTION π
This package hands you a command that takes snapshots of arbitrary canvases. Any canvas. Yours, theirs, the one you made at 3am. It doesn't care. It's giving equal opportunity photographer. π
π API π
::canvas::snap pathNameβ Takes a snapshot of the canvaspathName(yes, that exact canvas, the one you named). What you get back is the name of a new Tk photo image that holds the snapshot. So like, it doesn't just show you the pic, it births a photo image and tells you its name. Iconic behaviour, honestly. π
β οΈ bestie. listen. this command has a side-effect and you need to know about it. To avoid having white rectangles where other windows might overlap the canvas, it forces the toplevel window that the canvas lives in to the top of the stacking order. so your window is gonna jump to the front. that's not a bug, that's the price of a clean screenshot. you've been warned, mwah ππ
π¦ BUGS, IDEAS, FEEDBACK π¦
ngl, this document and the package it describes will undoubtedly contain bugs and other problems. it's a manpage, it's software, it's life. π
Please report such bugs in the category canvas of the Tklib Trackers:
http://core.tcl.tk/tklib/reportlist
And please also report any ideas you have for enhancements β for either the package and/or the documentation. they want your thoughts, they're literally asking, go tell them π«Ά
π KEYWORDS π
canvas, image, photo, print screen, snapshot
(so if you were searching for "print screen" in a Tcl manpage context β hi, you found her π)
β COPYRIGHT β
Copyright (c) 2004 George Petasis (http://wiki.tcl.tk/1404)
Copyright (c) 2010 Documentation, Andreas Kupries
and that's the whole page, bestie!! this one ships with tklib, version 1.0.1, and it lives at canvas::snap(3tk). go forth and screenshot your canvases, just don't be shocked when your window yeets itself to the front πβ¨
π¦ where this page comes from
- debian trixie: tklib 0.9-1
- ubuntu questing: tklib 0.9-1
- ubuntu resolute: tklib 0.9-1build1
- ubuntu stonking: tklib 0.9-1build1
- Copyright (c) 2004 George Petasis (http://wiki\&.tcl\&.tk/1404)
- Copyright (c) 2010 Documentation, Andreas Kupries
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms