Controlling PushButton height

20 views
Skip to first unread message

Brad Buran

unread,
Feb 17, 2022, 1:39:51 PM2/17/22
to Enaml
I'm trying to make an map of electrode coordinates (for an EEG experiment). The idea is that each PushButton is positioned where one might expect to find it on the head of a subject, making it easy to select the desired coordinates.

I've had some good success adapting the button ring example; however, I've run into an issue that I cannot get the height of the PushButton to scale as the window is resized. Is this a hard limitation of the Qt PushButton?

See attached code.

Brad
electrode_coordinates.csv
electrode_coordinates.enaml

Chris Colbert

unread,
Feb 17, 2022, 2:51:35 PM2/17/22
to Brad Buran, Enaml
This is more a limitation of how Enaml deals with constraints, not the constraint solver itself.

Enaml assumes that you are building “desktop-style” applications, where each “widget” has its own preferred intrinsic size. This means that parent containers expand to fit the size of their children. The layout is done “inside-out”. It sounds like you want an “outside-in” layout, where the children are sized to fit within their parent.

You may be able to get this to work by abusing the “hug-width” and “hug-height” attributes, but it might be a bit like ice skating uphill.

If it become a royal PITA, you may need to resort to RawWidget and your own custom QLayout.

--
You received this message because you are subscribed to the Google Groups "Enaml" group.
To unsubscribe from this group and stop receiving emails from it, send an email to enaml+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/enaml/cd021bc5-d541-4de2-a502-0e0f89cc050cn%40googlegroups.com.

Brad Buran

unread,
Feb 17, 2022, 4:09:38 PM2/17/22
to Enaml
Thanks for the response. That makes sense. I did play with the hug width and hug height attributes without too much luck. That said, I did come up with something I'm happy with. I've attached a full implementation as a self-contained example. The idea is that one will be able to do the following:
  • Click to select a single electrode for viewing.
  • Shift + click to select multiple electrodes for reference (the average of these electrodes are subtracted from the other electrodes).
It's more intuitive to do this when one has a "map" of the electrodes. I'd be happy to clean up this code and document it if you think it'd be useful for inclusion in the Enaml examples.

Brad
electrode_coordinates.enaml
electrode_coordinates.csv
Reply all
Reply to author
Forward
0 new messages