Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Enlarge tick boxes in QCM

Hi,

How can I modify the size of the tick boxes in a QCM form ? They are much too small for the kind of screen design that I need. More generally, how is it possible to adapt the QCM form, for instance by adding colors or other features ? I have found examples of code in the forum but I cannot go further. I do not practice Python (lack of time) but I could understand and adapt any code if it is documented. Or do I need to have a better knowledge of Python libraries ?

Thanks a lot,

Gérard

Comments

  • Hi Gérard,

    The checkboxes are hardcoded into the form theme. Therefore, to change them, you need to override the function that draws them. The script below takes two images from the file pool (box-checked-large.png and box-unchecked-large.png) and uses these to draw the checkboxes. You should add this code to the prepare phase of an inline_script at the very start of the experiment. And, of course, you should add these two images to the file pool.

    Warning: This script hacks into the undocumented internals of OpenSesame, and may break in future versions!

    from libopensesame.widgets.themes import gray
    
    def big_box(self, x, y, checked=False):
        if checked:
            img = pool['box-checked-large.png']
        else:
            img = pool['box-unchecked-large.png']
        return Image(img, center=False, x=x, y=y).construct(self.canvas)
    
    gray.gray.box = big_box
    

    Cheers!

    Sebastiaan

  • Thank you very much, Sebastiaan and sorry for the delay: I've been away since September.

    Cheers,

    Gérard

Sign In or Register to comment.