• ? BUG ? IMAGE put SystemButtonFace ...

    From aldo.w.buratti@gmail.com@21:1/5 to All on Sun Aug 20 06:31:29 2023
    Colors like
    SystemHighlightText, SystemWindowText, SystemHighlight, SystemButtonFace, ...

    can be used for setting some widgets' colors
    frame .f -background SystemButtonFace
    but they cannot be used for filling a tk-photo image

    image create photo IMAGE
    IMAGE put SystemButtonFace -to 0 0 40 40
    --> can't parse color "SystemButtonFace"

    Is this a bug ?
    Is there a workaround for filling IMAGE with these colors ?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Manfred Stelzhammer@21:1/5 to All on Sun Aug 20 17:02:55 2023
    Hi

    Try

    frame .f -background SystemButtonFace
    image create photo IMAGE
    IMAGE put [.f cget -background] -to 0 0 40 40


    regards

    Manfred

    Am 20.08.23 um 15:31 schrieb aldo.w....@gmail.com:
    Colors like
    SystemHighlightText, SystemWindowText, SystemHighlight, SystemButtonFace, ...

    can be used for setting some widgets' colors
    frame .f -background SystemButtonFace
    but they cannot be used for filling a tk-photo image

    image create photo IMAGE
    IMAGE put SystemButtonFace -to 0 0 40 40
    --> can't parse color "SystemButtonFace"

    Is this a bug ?
    Is there a workaround for filling IMAGE with these colors ?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Sun Aug 20 17:27:52 2023
    Am 20.08.2023 um 15:31 schrieb aldo.w....@gmail.com:
    Colors like
    SystemHighlightText, SystemWindowText, SystemHighlight, SystemButtonFace, ...

    can be used for setting some widgets' colors
    frame .f -background SystemButtonFace
    but they cannot be used for filling a tk-photo image

    image create photo IMAGE
    IMAGE put SystemButtonFace -to 0 0 40 40
    --> can't parse color "SystemButtonFace"

    Is this a bug ?
    Is there a workaround for filling IMAGE with these colors ?

    That is normal, not a bug.

    Try also:
    winfo rgb . SystemButtonFace

    Take care,
    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aldo.w.buratti@gmail.com@21:1/5 to All on Sun Aug 20 09:25:54 2023
    Il giorno domenica 20 agosto 2023 alle 17:03:00 UTC+2 Manfred Stelzhammer ha scritto:
    Hi

    Try

    frame .f -background SystemButtonFace
    image create photo IMAGE
    IMAGE put [.f cget -background] -to 0 0 40 40


    regards

    Manfred

    Am 20.08.23 um 15:31 schrieb aldo.w....@gmail.com:
    Colors like
    SystemHighlightText, SystemWindowText, SystemHighlight, SystemButtonFace, ...

    can be used for setting some widgets' colors
    frame .f -background SystemButtonFace
    but they cannot be used for filling a tk-photo image

    image create photo IMAGE
    IMAGE put SystemButtonFace -to 0 0 40 40
    can't parse color "SystemButtonFace"

    Is this a bug ?
    Is there a workaround for filling IMAGE with these colors ?

    Same error ... can't parse color "SystemButtonFace"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From saitology9@21:1/5 to aldo.w....@gmail.com on Sun Aug 20 13:57:24 2023
    On 8/20/2023 9:31 AM, aldo.w....@gmail.com wrote:
    Colors like
    SystemHighlightText, SystemWindowText, SystemHighlight, SystemButtonFace, ...

    can be used for setting some widgets' colors
    frame .f -background SystemButtonFace
    but they cannot be used for filling a tk-photo image

    image create photo IMAGE
    IMAGE put SystemButtonFace -to 0 0 40 40
    --> can't parse color "SystemButtonFace"

    Is this a bug ?
    Is there a workaround for filling IMAGE with these colors ?


    I think those are symbolic names that are platform dependent and that
    are only recognized by built-in widgets.

    In any case, I use something like this:

    proc get_color_code {c} {
    lassign [winfo rgb . $c] r g b
    set r [expr {$r % 256}]
    set g [expr {$g % 256}]
    set b [expr {$b % 256}]
    format "\#%02x%02x%02x" $r $g $b
    }


    % get_color_code SystemHighlight
    #0078d7

    % get_color_code SystemButtonFace
    #f0f0f0

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From aldo.w.buratti@gmail.com@21:1/5 to All on Sun Aug 20 12:52:41 2023
    Il giorno domenica 20 agosto 2023 alle 19:57:32 UTC+2 saitology9 ha scritto:
    On 8/20/2023 9:31 AM, aldo.w....@gmail.com wrote:
    Colors like
    SystemHighlightText, SystemWindowText, SystemHighlight, SystemButtonFace, ...

    can be used for setting some widgets' colors
    frame .f -background SystemButtonFace
    but they cannot be used for filling a tk-photo image

    image create photo IMAGE
    IMAGE put SystemButtonFace -to 0 0 40 40
    can't parse color "SystemButtonFace"

    Is this a bug ?
    Is there a workaround for filling IMAGE with these colors ?
    I think those are symbolic names that are platform dependent and that
    are only recognized by built-in widgets.

    In any case, I use something like this:

    proc get_color_code {c} {
    lassign [winfo rgb . $c] r g b
    set r [expr {$r % 256}]
    set g [expr {$g % 256}]
    set b [expr {$b % 256}]
    format "\#%02x%02x%02x" $r $g $b
    }


    % get_color_code SystemHighlight
    #0078d7

    % get_color_code SystemButtonFace
    #f0f0f0
    OK this works,
    I'm still of the opinion that *all* the Tk commands (e.g. photo ..) should understand these 'symbolic' color-name, too.

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