Py学习  »  tornado

TornadoFx透明视图

Balage1551 • 5 年前 • 1268 次点击  

我想创建一个具有部分透明背景的视图(阶段、窗口)。我有个包含alpha通道的图像

an image containing alpha channel

我在javafx中使用了这种场景,我必须将场景填充设置为空,并将根节点背景色设置为透明。我也尝试过龙卷风:

class NextRoundView : View("Következő kör") {

    override val root = vbox {
        style {
            backgroundColor = multi(Color.TRANSPARENT)
            backgroundImage = multi(URI.create("/common/rope-bg-500x300.png"))
            backgroundRepeat = multi(BackgroundRepeat.NO_REPEAT 
                                  to BackgroundRepeat.NO_REPEAT)
        }
        prefWidth = 500.0
        prefHeight = 300.0

        spacing = 20.0
        padding = insets(50, 20)
        text("A text") {
            font = Font.font(40.0)
            alignment = Pos.CENTER
        }

        button("OK")
        {
            font = Font.font(20.0)
            action {
                close()
            }
        }
        sceneProperty().addListener{ _,_,n ->
            n.fill = null
        }
    }

}

我这样称呼这个观点:

NextRoundView().apply { 
    openModal(stageStyle = StageStyle.TRANSPARENT, block = true) 
}

然而,该阶段仍有背景:

enter image description here

我错过了什么?

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/30819
 
1268 次点击  
文章 [ 1 ]  |  最新文章 5 年前