Abhishek dot py
Abhishek dot py

Reputation: 939

Button release event is not working in Kivy

The problem is that I can fire an event when a button is pressed, but the button release is not working; here is my .kv code:

Button:
    id: my_custom_label
    text: 'SOS'
    height: "95dp"
    width: "160dp"
    on_press: app.sendprogress()   # this is working
    on_release : app.sendhelp()    # this is not working
    size_hint: None, None
    pos_hint: {'center_x': .1, 'center_y': .1}
    canvas.before:
        PushMatrix
        Rotate:
            angle: 0
            origin: self.center
    canvas.after:
        PopMatrix

The error I am seeing is this:

32:               on_press: app.sendprogress()
>> 33:               on_release : app.sendhelp()
34:               size_hint: None, None
35:        pos_hint: {'center_x': .1, 'center_y': .1}
...
Invalid property name

Upvotes: 0

Views: 622

Answers (1)

Matt
Matt

Reputation: 1347

Try remove the space before the colon: i.e. instead of on_release : app.sendhelp() do on_release: app.sendhelp(). I think that you're not allowed to have a space there.

Upvotes: 3

Related Questions