You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As the pylibui wrapper is supposed to be pythonic, I thought it would be great to use the properties instead of defining setValue/getValue-like methods.
Here is a little implementation example for checkboxes checked attribute:
@property
def checked(self):
"""
Returns whether the checkbox is checked or not.
:return: bool
"""
return libui.uiCheckboxChecked(self.control)
@checked.setter
def checked(self, checked):
"""
Sets whether the checkbox is checked or not.
:param checked: bool
:return: None
"""
libui.uiCheckboxSetChecked(self.control, checked)
That way, that would allow us to do things like:
if my_checkbox.checked:
my_checkbox.checked = False
instead of...
if my_checkbox.getChecked():
my_checkbox.setChecked(False)
What do you think ? Should I make a PR for this ?
Have a good day,
Nicolas.
The text was updated successfully, but these errors were encountered:
I think it's a good idea, but we should let it mature a little bit until we implement more things in pylibui. My rationale is that somewhere in the future we may have to decide which functions are worth wrapping as properties and which functions not and until then we won't be sure which things are common on the api.
For now, let's keep this issue open, but it's more important to continue implementing the libui ctypes wrapping functions so that we can match libui's functionality.
Hello,
As the
pylibui
wrapper is supposed to be pythonic, I thought it would be great to use the properties instead of definingsetValue
/getValue
-like methods.Here is a little implementation example for checkboxes
checked
attribute:That way, that would allow us to do things like:
instead of...
What do you think ? Should I make a PR for this ?
Have a good day,
Nicolas.
The text was updated successfully, but these errors were encountered: