crosshair(3tk)
π crosshair β bestie edition π
okay so this is the manual page for crosshair(3tk), which lives in the Crosshairs section of the manual. it's a Tcl/Tk thing, it's giving sparkle, and yes i am about to explain the whole entire thing to you. sit down, hydrate, let's go π«Ά
β¨ NAME β¨
crosshair β Crosshairs for Tk canvas
πΈ SYNOPSIS πΈ
package require Tcl ?8.4?
package require Tk ?8.4?
package require crosshair ?1.2.1?
crosshair::crosshair w ?arg...?
crosshair::off w
crosshair::configure w ?arg...?
crosshair::track on w cmdprefix
crosshair::track off w
crosshair::bbox_add w bbox
crosshair::bbox_remove token
π DESCRIPTION π
so the crosshair package gives you commands to (de)activate and track crosshairs on canvas widgets. that's it. that's the whole vibe. you turn 'em on, you turn 'em off, you follow the mouse around. iconic behavior honestly π
π API π
the following commands are exported to the public. no cap, these are the ones you get:
π crosshair::crosshair w ?arg...?
this one activates the display of a pair of cross-hairs for the canvas widget w. the cross-hairs track the pointing device (the mouse, bestie, the mouse). the result of the command is the empty string.
every argument after the widget w gets treated as options, exactly like they would be for a canvas line item in w. the two you actually care about are -fill and -dash. β¨
π crosshair::off w
this removes the cross-hairs from the canvas widget w. if the widget had no cross-hairs to begin with? nothing happens. no drama. the result of the command is the empty string.
π crosshair::configure w ?arg...?
this changes the appearance of the cross-hairs in canvas widget w. it is an error to call it for a canvas which has no cross-hairs. like, you can't configure a vibe that isn't there, bestie π
all arguments after the widget w are treated as options as for a canvas line item in w. again, -fill and -dash are the stars of the show.
the result of the command is the current configuration settings.
π crosshair::track on w cmdprefix
this activates reporting of the location of the cross-hairs in the canvas widget w. it is an error to use this command for a canvas which has no cross-hairs. the result of the command is the empty string.
after you invoke this, the specified command prefix cmdprefix gets called whenever the mouse moves within the canvas, with 7 arguments. seven!! and they are, in order:
- The widget
w - The x-location of the cross-hairs, in pixels.
- The y-location of the cross-hairs, in pixels.
- The x-location of the top-left corner of the viewport, in pixels.
- The y-location of the top-left corner of the viewport, in pixels.
- The x-location of the bottom-right corner of the viewport, in pixels.
- The y-location of the bottom-right corner of the viewport, in pixels.
β οΈ a previously existing callback for w will be disabled. i.e. per canvas widget with cross-hairs, only one callback reporting their location is possible. one (1) callback. that's the rule. no poly, sorry π
π crosshair::track off w
this disables the reporting of the location of the cross-hairs in the canvas widget w. it is an error to use this command for a canvas which has no cross-hairs. the result of the command is the empty string.
π crosshair::bbox_add w bbox
this adds a bounding box to the crosshairs for canvas w. the crosshairs will only be active within that area. like a little VIP section for your cursor π
the result of the command is a token, which you use to remove the bounding box again later β see crosshair::bbox_remove below.
the bounding box bbox is specified through a list of 4 values: the lower left and upper right corners of the box. the order of values in the list is:
llx lly urx ury
note that this command can be used multiple times, each call adding one more bounding box. in such a case the visible area is the union of all the specified bounding boxes. stacking them, no cap π
π crosshair::bbox_remove token
this removes the bounding box specified by the token (a result of crosshair::bbox_add) from the crosshairs for its canvas widget. bye bestie π
π BUGS, IDEAS, FEEDBACK π
this document, and the package it describes, will undoubtedly contain bugs and other problems. like, obviously. please report such in the category tklib :: crosshair of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. please also report any ideas for enhancements you may have for either package and/or documentation. we want the ideas fr fr π
π BUGS, IDEAS, FEEDBACK π (part two, the encore)
yes there's another one, and yes you still need to know it. this document, and the package it describes, will undoubtedly contain bugs and other problems. please report such in the category crosshair of the Tklib Trackers [http://core.tcl.tk/tklib/reportlist]. please also report any ideas for enhancements you may have for either package and/or documentation. same energy, different tracker URL. both are real, both count π«Ά
π KEYWORDS π
canvas, cross-hairs, location, tracking, viewport
Β©οΈ COPYRIGHT Β©οΈ
Copyright (c) 2003 Kevin Kenny
Copyright (c) 2008 (docs) Andreas Kupries <andreas_kupries@users.sourceforge.net>
Copyright (c) 2013 Frank Gover, Andreas Kupries
okay so that's the whole page, you ate that, i'm obsessed π this was tklib version 1.2.1, dated back in the day, and it's the crosshair(3tk) manual page β go forth and crosshair, main character π§β¨π
π¦ 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) 2003 Kevin Kenny
- Copyright (c) 2008 (docs) Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- Copyright (c) 2013 Frank Gover, Andreas Kupries
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms