P
P
pecenuska21352021-10-05 20:36:13
Python
pecenuska2135, 2021-10-05 20:36:13

Why does the function call cause an error?

gl = GridLayout(orientation= 'lr-tb', padding=[0, 100, 0, 0], cols = 3)

        def BoxOneP():
            box1 = gl.add_widget( Button(text="Ячейка 2"))

        box1 = gl.add_widget( Button(text="Ячейка 1", on_press = BoxOneP() ))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-10-05
@pecenuska2135

> on_press = BoxOneP ()
You assign the on_press parameter to the result of calling the BoxOneP function. Which returns None.
Maybe they just meant "on_press=BoxOneP" after all?
And yes, what does "breaks the application" mean? The text of the error with a stack trace from the studio.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question