Menu

#2213 Wrong rendering in transparent areas

obsolete: 8.5a5
open
3
2007-02-16
2007-02-15
Anonymous
No

When using the option -background "", frames are transparent, but transparent area is never redrawn at all.
It seems Tk ignore these areas by applying no treatment at all....
Everything placed on a transparent frame (even dragging an other application window from the desktop throw this kind of area) can't be graphically removed after even if it was effectively removed according to the placement manager.
Here's the code wich reproduces this:

#######################################################
proc refreshPrLayer {framePath} {
update
set FrameWidth [winfo width $framePath]
set FrameHeight [winfo height $framePath]
$framePath configure -width 0
update
$framePath configure -width $FrameWidth -height $FrameHeight
}

canvas .c -width 100 -height 100 -bg "#800000" -borderwidth 0 -highlightthickness 0
frame .c.f1 -width 200 -height 50 -background ""
frame .c.f2 -width 200 -height 50 -background ""
frame .c.f1.f1 -background "#0000FF" -width 50 -height 50 -borderwidth 0 -highlightthickness 0
frame .c.f2.f1 -background "#FFFFFF" -width 50 -height 50 -borderwidth 0 -highlightthickness 0
frame .c.f2.f2 -background "#00FFFF" -width 50 -height 50 -borderwidth 0 -highlightthickness 0
pack .c -fill both -expand 1
pack .c.f1 .c.f2 -side top -anchor w
pack .c.f1.f1 -side left -padx 10 -pady 10 -fill both -expand 1
pack .c.f2.f1 .c.f2.f2 -side left -padx 10 -pady 10 -fill both -expand 1

after 2000 {
destroy .c.f2.f1
# Uncomment the next line to see a trick wich can refresh the transparent area (destroyed frame will disappear as it should without the trick) or just drag a window from your desktop throw the tcl one to see the problem
# refreshPrLayer .c.f2
}
#####################################################

Discussion

  • Donal K. Fellows

    • milestone: --> obsolete: 8.5a5
    • priority: 5 --> 3
     
  • Donal K. Fellows

    Logged In: YES
    user_id=79902
    Originator: NO

    I've known about this for ages, but I've not really got much of an idea what to do about it. We certainly can't use the XShape extension to help, because we don't want to clip subwindows. Perhaps using an InputOnly window would work better, but I don't know what impact that would have on the rest of Tk.

    I don't know what to do about it on Windows or OSX at all.

    FWIW, this has existed since at least Tk 4.0; I can remember encountering it back when I was learning. My fix? "Don't use -background {} in frames." (There may be some specialized uses though; ISTR something with video rendering where the aim was to get Tk to stop drawing a widget so that something else could do the job...)