Change suggestion: direct/src/gui/DirectCheckButton.py

Hi everyone!

I was having a bit of difficulty building DirectCheckButtons using a custom image: when I used a custom image, the grey frame that normally shows up around the ‘’ icon was still visible, even though no '’ needed to be drawn. I’m not sure if this is the intended behavior of the checkbox or not, but it made it difficult to replace the checkbox icon with another image.

Unless this is, in fact, the desired behavior (or there is another way to do away with the frame), I recommend we modify the source of DirectCheckButton.py to insert the following line after line 57:


            self.indicator['frameColor']=(0,0,0,0)

This should shut down the frame in all circumstances where the ‘*’ icon would be replaced by a developer-provided image.

What do people think?
-Mark

The way to turn off the frame generated for the checkbox part of a DirectCheckButton is to specify the parameter:


boxRelief = None

You probably also want to specify:


relief = None

which is the frame around the button as a whole.

Incidentally, you can specify any configuration parameter to the constructor, including configuration parameters for nested components, by prefixing the component name with an underscore separator. In the case of the DirectCheckButton, the checkbox part is called “indicator”. So if you wanted to configure the frameColor to invisible (which is not exactly the same as configuring boxRelief to None), you could simply say:


DirectCheckButton(indicator_frameColor = (0, 0, 0, 0), image=(...))

It follows, of course, that you could use indicator_image and indicator_relief instead of boxImage and boxRelief. I suspect that whoever first implemented DirectCheckButton didn’t know about this detail of the DirectGui system, and thus didn’t realize that the boxImage and boxRelief parameters were redundant.

David