Re: Kivy binding widgets to buttons

26 views
Skip to first unread message
Message has been deleted

Alexander Taylor

unread,
Jul 1, 2015, 4:08:20 PM7/1/15
to kivy-...@googlegroups.com, compsc...@gmail.com
Post a full working example.

On Wednesday, 1 July 2015 20:40:09 UTC+1, icecream299 wrote:

I'm trying to bind the endpoints of a line to the center of two buttons, however the line does not update as the buttons move. Here is my function that attempts to update the line:

def create_line(self):
    with self.canvas:
        l = Line(points = (self.pressedinputs[0].center + self.pressedoutputs[0].center), width = 3)

    c1 = self.pressedinputs[0].parent
    c2 = self.pressedoutputs[0].parent


    def update(l,*args):
        l.points = (self.pressedinputs[0].center + self.pressedoutputs[0].center)

    c1.bind(pos = update)
    c2.bind(pos = update)

The buttons are defined as self.pressedinputs[0] and self.pressedoutputs[0] and I was binding the update to the buttons' parents, which when moved will also move the button.

The function only makes a line at the current position of the buttons and do not update. How can I bind the lines?

Reply all
Reply to author
Forward
0 new messages