New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EventGhost] - Enhancement - Utils.EqualizeWidths, #286
base: master
Are you sure you want to change the base?
Conversation
eg.EqualizeWidths was coded to accept a single iterable of controls. I have found this very limiting. So what I have done is it uses *args and you can pass single controls as positional areuments, or you can pass nested lists/tuples or a combination eg.EqualizeWidths(ctrl1, ctrl2, ctrl3, ctrl4) works the same as eg.EqualizeWidths((ctrl1, ctrl2, ctrl3, ctrl4)) eg.EqualizeWidths((ctrl1, ctrl2, ctrl3, ctrl4), (ctrl5, ctrl6, ctrl7, ctrl8)) this will set the widths the same for all of the controls in tuple 1. and then it will set the widths the same for tuple 2. tuple 1 will not have the same widths as tuple 2 eg.EqualizeWidths(ctrl1,(ctrl2, ctrl3, ctrl4), ctrl5, (ctrl6, ctrl7, ctrl8)) the tuples works the same as above but in this example you see ctrl1 and ctrl 5 are not in a tuple. those 2 controls will have matching widths but they will not match the widths of tuple 1 or tuple 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I think we can include it 0.5 as it is only a small change.
I am going to run it through a full gambit of tests to make sure everything is OK with it. |
OK I gave it a good test. It's good to go. |
do you understand what the benefit to this would be? You have the ability to create a horizontal sizer add the label and then the control. and you will only have to make the call to EqualizeWidths one time. bundle all the label controls together and bundle all of the other controls together and pass then at the same time. If you use eg.BoxedGroup it becomes really easy. because you do not need to create a variable for each label. you can pass the instance of the label directly to BoxedGroup then do
and for the real trip.
This would work if all of your controls have a GetValue method So now you can pass the labels and the controls directly to the BoxedGroup without the need to create variables for them. This would be used for very simple dialogs but it is a really nice convenience. |
eg.EqualizeWidths was coded to accept a single iterable of controls. I have found this very limiting.
So what I have done is it uses *args and you can pass single controls as positional areuments, or you can pass nested lists/tuples or a combination
These work exactly like before with no changes
below will set the widths the same for all of the controls in tuple 1. and then it will set the widths the same for tuple 2. tuple 1 will not have the same widths as tuple 2
in the example below the tuples works the same as above but in this example you see ctrl1 and ctrl5 are not in a tuple. those 2 controls will have matching widths but they will not match the widths of tuple 1 or tuple 2