crosshair(3tk)

πŸ“¦
version 0.9 Β· 3 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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:

  1. The widget w
  2. The x-location of the cross-hairs, in pixels.
  3. The y-location of the cross-hairs, in pixels.
  4. The x-location of the top-left corner of the viewport, in pixels.
  5. The y-location of the top-left corner of the viewport, in pixels.
  6. The x-location of the bottom-right corner of the viewport, in pixels.
  7. 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 (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