Tk Source Code

View Ticket
Login
Ticket UUID: 1085451
Title: flickering with -alpha transparency manipulations
Type: Bug Version: obsolete: 8.5a3
Submitter: vincentdarley Created on: 2004-12-14 22:39:57
Subsystem: 68. Win Window Operations Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2026-09-28 15:57:34
Resolution: Fixed Closed By: hobbs
    Closed on: 2004-12-14 22:52:53
Description:
The attached script makes windows (WinXP) smoothly
transition from -alpha 0.0 to -alpha 1.0 (in fact a
little bit larger than 1.0 which might be the root of
the problem), and at the last step the entire window
suddenly flickers horribly.

i.e. the transition from 0.0 to 0.99 is really nice and
then just as the window reaches 1.0 or thereabouts,
there's a horrible flicker..
User Comments: serhiy.storchaka added on 2026-09-28 15:57:34:

Fixed in [099e9edbef]: the WS_EX_LAYERED style is now only added, never removed, so the window is not recreated when -alpha returns to 1.0. With 8.6 and 9.1 on Windows 11 the wrapper window stays the same during a fade from 0.0 to 1.0.


hobbs added on 2004-12-15 06:04:04:
Logged In: YES 
user_id=72656

This is not a bug - this is a behavior, and it could be
documented.  This is not at all the only thing to cause such
flickering - a lot of 'wm' operations will cause it, if you
hadn't noticed before.

As for switching ... we could set a flag I suppose, but if
you look at the code, it isn't otherwise trivial to know
this.  As I said, lots of 'wm' calls can force a wrapper update.

vincentdarley added on 2004-12-15 05:58:49:
Logged In: YES 
user_id=32170

Given that -alpha transitions are largely used for cosmetic
purposes (often for windows which are transient in nature),
wouldn't it make sense to simply adopt the policy that if a
window has ever had a non 1.0 transparency that we always
use the transparent-capable class?

This would solve the problem at the expense of some amount
of memory (according to your comments), which is likely to
be freed up soon anyway, since most such windows are transient.

Failing that this should be documented as a known bug in the
Tk man pages, shouldn't it?

hobbs added on 2004-12-15 05:52:53:
Logged In: YES 
user_id=72656

This is a known issue and was discussed on clt.  The problem
is the transition of Windows window classes, which causes an
update of the wrapper window (and the flicker).  This occurs
at any !=1.0 to 1.0 transition.

The solutions are not simple ... the problem is that to
support alpha transparency, you have to use a much more
memory hungry window class, which is for obvious reasons not
the default class.  I may TIP up a solution that adds a wm
attr -class option that is automatically mangled with
changes in certain other attr settings, but there is no user
transparent way to handle this.

The work-around is to stop at 0.99, if you intend to keep
something optionally transparent.  This is fully opaque from
a transparency perspective, but keeps the
transparent-enabled window class.

vincentdarley added on 2004-12-15 05:39:57:

File Added - 112487: transparency.tcl

Attachments: