[solved] How to increase widget size
Hi, I was wondering how to scale up a check box widget that I create using an in-line python script. For my experiment I use a larger font (32pt) and check boxes appear too small next to their labels. Ideally I'd like to avoid building a custom widget just to get this. Any suggestions are welcome.
Comments
Hi Mitko,
Isn't
set widget_label "<span size=23>WIDGET</span>"what you're looking for?Alternatively, you might let your widget span over multiple cells. Unfortunately, I can't really tell how this works. I just saw on the documentation that it is somehow possible.
Good luck,
Eduard
Hi Eduard,
Thanks for your suggestion. I don't quite understand where I am supposed to enter the text you wrote. I'm creating the widget using python and your suggestion looks more like the standard OpenSesame script. Can I mix the two?
Also, does your suggestion really scale the check box itself or just its label? The labels that I have are already using the 32pt font size automatically. It's just the square checkbox in front of the label that looks tiny. This is what I'd like to enlarge.
As a workaround in the mean time, I have the following solution: I made a new python class that inherits from widgets.checkbox and reimplements the render method. Instead of drawing a box from an image (which is what the standard OpenSesame checkbox uses in widgets.checkbox ) I just draw the label preceded with the unicode characters for an empty/checked box
Here is the code in case anyone is interested:
Cheers,
Mitko
Oh sorry. Apparently, I haven't read your questions. Indeed my suggestions works only for opensesame buit-in forms.
If you only want the box to be bigger, you could have also just changed the
self.box_sizevariable during initialization of your selfmade Checkbox class, but your solution seems to do the trick as well.Sorry again for the confusion. If everything is good now, I will mark this thread as solved, okay?
Eduard
Hi Eduard,
I tried changing the
box_sizeas you suggested, but that only moved the text a little. The actual check box was still drawn the same size as before. Looking at the code in GitHub it seems that both available theme engines right now draw checkboxes with a fixed size (either 16 or taken from the standard checkbox image) and don't care about thecheckbox.box_sizefield.Anyway, I'm happy with my current solution. Using the corresponding Unicode characters actually looks quite decent, so I'll stick with that. You can mark this thread as solved.
Cheers,
Mitko
Hi Mitko,
Your solution is pretty elegant, but for the less Python-savvy I would like to point out yet another solution: You could replace the checkbox images in the
resources/widgets/gray/folder (which is a subfolder of the OpenSesame program folder on Windows).Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hey @mitko,
I have the same problem with the too small check boxes. I tried the solution from @sebastiaan but it doesn't work so well (sorry :( ). First, the frame around the boxes stays the same size and somehow the larger checkboxes don't click so well. I would be interested in your workaround. Could you maybe go into more detail about how you did it?@sebastiaan
Thank you!
Hi Mirko,
Can you try to locate the folder that Sebastiaan pointed out? If you find it, you can replace the file in it with another file that contains a checkbox of your liking. Should be a simple image file. On my system (Ubuntu) the files are located here:
Hope this helps.
Eduard