I didn’t find this info in the manual or in the API reference page of DirectRadioButton.
This is explained at the bottom of the DirectCheckButton page, but perhaps it is worth repeating on the DirectRadioButton page as well.
In short, most DirectGUI properties can be specified as a tuple, one for each state, so you want to do something like this:
btn = DirectRadioButton( ...other properties..., boxImage=('unchecked.png', 'checked.png'), ) # Disable the default asterisk btn.indicator['text'] = ('', '')
The same should apply to boxImageColor.
I think the problem is “indicator” is not listed. Thank you.
Ah, yes, indicator is in fact a DirectLabel component. I will add this to the manual.
Actually indicator seems to be the box itself, what’s the name for the *?
The indicator component is a DirectLabel; the tick mark is the text on the label, and the boxImage is set as the background image of that label. If you wanted a specific image for the tick mark that is separate from the image of the box, I think you would need to create an OnscreenImage and parent it to the indicator, or pass it as boxGeom, or something like that.
Alternatively, if you are already using an icon font (like font-awesome) in the UI of your application, you can set the text_font of the indicator to the desired icon font, and set the text to the Unicode character for that icon (eg. ‘\uf00c’ for the font-awesome tick mark).
Okay. Seems I bit counterintuitive that the tick mark is referred to as “indicator_text”, but it works I guess.
Any ideas why indicator_color = (1,1,1,1) makes the indicator gray rather than white? my other settings are just relief = None and boxRelief = DGG.FLAT.
Hmm… I just tried it quickly on my end, and I seem to get white with an indicator_color of “(1, 1, 1, 1)”.
You say that your other settings are just to “relief” and “boxRelief”–are you setting nothing else at all? If you are, could we see the rest of your radio-button parameters, please? Perhaps something else is affecting it.
Otherwise, perhaps it’s an effect accrued from whatever you’re parenting the radio-button to–if that has a colour-scale applied, it might affect your radio-button.
The issue seems to be the parent having setTransparency(TransparencyAttrib.MAlpha) on it. When that line code is commented out, indicator_color on the child node works fine.
Hmm… In that case, could it be that you’ve set the object, or some parent of it, to have partial transparency and are thus seeing the clear-colour through it?