• Re: Translucent overlay of photo

    From Rich@21:1/5 to Claude Rubinson on Mon Apr 8 19:11:03 2024
    Claude Rubinson <[email protected]> wrote:
    I have a Tk app that has a series of photos arranged in a grid. Each
    photo is embedded in its own canvas. I'd like to indicate that a photo
    has been selected by the user by highlighting it with a translucent
    overlay. Is this possible? My initial investigation indicates that Tk doesn't (yet) support alpha blending?

    One 'workaround' if Tk does not support alpha blending is to have
    present in the app two versions of the photo, one without and a second
    with the overlay present. Then for a "selected" photo you swap the
    "without" and "with" versions (remembering to "unswap" the last
    selected one as well).

    Of course this only works if the overlay is completely static.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Claude Rubinson@21:1/5 to All on Mon Apr 8 13:56:48 2024
    I have a Tk app that has a series of photos arranged in a grid. Each
    photo is embedded in its own canvas. I'd like to indicate that a photo
    has been selected by the user by highlighting it with a translucent
    overlay. Is this possible? My initial investigation indicates that Tk
    doesn't (yet) support alpha blending?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralf Fassel@21:1/5 to All on Tue Apr 9 10:36:15 2024
    * Claude Rubinson <[email protected]>
    | I have a Tk app that has a series of photos arranged in a grid. Each
    | photo is embedded in its own canvas. I'd like to indicate that a
    | photo has been selected by the user by highlighting it with a translucent
    | overlay. Is this possible? My initial investigation indicates that
    | Tk doesn't (yet) support alpha blending?

    A different approach might be to add a border around each canvas and
    highlight that to indicate the selected one:

    grid [canvas .c1 -highlightthickness 3 -highlightcolor blue -borderwidth 2 -relief ridge] -row 0 -column 0 -sticky ewnw
    grid [canvas .c2 -highlightthickness 3 -highlightcolor blue -borderwidth 2 -relief ridge] -row 0 -column 1 -sticky ewnw
    grid [canvas .c3 -highlightthickness 3 -highlightcolor blue -borderwidth 2 -relief ridge] -row 1 -column 0 -sticky ewnw
    grid [canvas .c4 -highlightthickness 3 -highlightcolor blue -borderwidth 2 -relief ridge] -row 1 -column 1 -sticky ewnw

    bind .c1 <Button-1> {focus %W}
    bind .c2 <Button-1> {focus %W}
    bind .c3 <Button-1> {focus %W}
    bind .c4 <Button-1> {focus %W}

    grid rowconfigure . 0 -weight 1
    grid rowconfigure . 1 -weight 1
    grid columnconfigure . 0 -weight 1
    grid columnconfigure . 1 -weight 1

    HTH
    R'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)