Problems applying transparency to a DirectButton

I don’t know if I am doing anything wrong, but I can’t seem to find a way to load a transparent texture onto the DirectButton element. I have tried to load it with just the texture, I tried adding it to a .egg texture card, but no matter where I apply the transparency (Even calling .setTransparency on the button itself) It shows up as white or grey on the transparent pieces. Is there a specific method to get this to work?

First of all, greetings, and welcome to the forum! I hope that your time here proves to be positive! :slight_smile:

As to your question… I’d guess that what you’re seeing is the default button-geometry showing up behind your image.

How are you applying your texture? Are you using the “frameTexture” parameter, or the “image” parameter?

If you’re using “frameTexture”, then I’d suggest setting the “relief” parameter to “DGG.FLAT”.

Conversely, if you’re using “image”, then I’m not certain–I usually use “frameTexture”–but I think that setting the “relief” to “None” should do the trick.

(Either way along with calling “setTransparency(True)” on the button, of course.)

1 Like

Complementing a bit what taumaturgo already mentioned about the relief.

If you are using “frameTexture”, the image must have the alpha channel.

If you are using “Image” or “geom”, you could apply a “frameColor” with alpha at zero, for example:

button["frameColor"] = (1.0,1.0,1.0,0.0)

Regards

2 Likes

Thank you!
I added the “relief” parameter, and that fixed about half of it, it was still showing up as blank white only on the image part, so Logan’s solution solved my problem.

2 Likes