refactor: Rename click kwarg to on_click for API consistency (closes #126)
BREAKING CHANGE: Constructor keyword argument renamed from `click` to `on_click` for all UIDrawable types (Frame, Caption, Sprite, Grid, Line, Circle, Arc). Before: Frame(pos=(0,0), size=(100,100), click=handler) After: Frame(pos=(0,0), size=(100,100), on_click=handler) The property name was already `on_click` - this makes the constructor kwarg match, completing the callback naming standardization from #139. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
58efffd2fd
commit
c9c7375827
14 changed files with 1953 additions and 237 deletions
|
|
@ -400,7 +400,7 @@ PyObject* UICircle::repr(PyUICircleObject* self) {
|
|||
int UICircle::init(PyUICircleObject* self, PyObject* args, PyObject* kwds) {
|
||||
static const char* kwlist[] = {
|
||||
"radius", "center", "fill_color", "outline_color", "outline",
|
||||
"click", "visible", "opacity", "z_index", "name", NULL
|
||||
"on_click", "visible", "opacity", "z_index", "name", NULL
|
||||
};
|
||||
|
||||
float radius = 10.0f;
|
||||
|
|
@ -480,7 +480,7 @@ int UICircle::init(PyUICircleObject* self, PyObject* args, PyObject* kwds) {
|
|||
// Handle common UIDrawable properties
|
||||
if (click_obj && click_obj != Py_None) {
|
||||
if (!PyCallable_Check(click_obj)) {
|
||||
PyErr_SetString(PyExc_TypeError, "click must be callable");
|
||||
PyErr_SetString(PyExc_TypeError, "on_click must be callable");
|
||||
return -1;
|
||||
}
|
||||
self->data->click_register(click_obj);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue