Why dialogs created with CreateDialog
cannot correctly show content with transparent background? The following example generates a plot, with white background, though it should be gray, as that is the default color of the dialog window of Windows. If, however, I move a window in front of the dialog covering it halfway or totally, the background reverts to the default panel-gray (see figures below).
CreateDialog[DocumentNotebook[
Plot[Sin@x, {x, 0, 2 \[Pi]}, Frame -> True, Axes -> False,
Background -> None, ImagePadding -> 30, ImageSize -> 300]
]];
(Left: the new dialog as it appears. Middle: covering the dialog halfway with another window, then removing the covering window. Right: Covering the window fully, and then revealing.)
The following approach does not work either:
Background -> Directive[Red, Opacity[0]]
This behaviour is more emphasized if the content is dynamic:
CreateDialog[DocumentNotebook[Column@{
Slider@Dynamic@n,
Dynamic@Plot[Sin@x, {x, 0, n \[Pi]}, Frame -> True, Axes -> False,
Background -> None, ImagePadding -> 30, ImageSize -> 300]
}]];
While it appears first with white background, even mouse movements cause it to turn into the desired gray color.
My problem is that I have a gui, where a plot is created and updated in real time. I would like to have its background to be the color of the underlying panel, but it continuously switches between white and gray during updating. Any idea how to overcome this?
CreateDialog
seems to help on my system at least, e.g.CreateDialog[..., Background -> LightGray]
. $\endgroup$Plot[..., Background -> Yellow]
is displayed correctly. OnlyPlot[..., Background -> None]
has this problem. $\endgroup$Background->White
command... $\endgroup$Background->Opacity[0]
work? $\endgroup$