Python Forum
[Kivy] Button - How to call functions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Kivy] Button - How to call functions
#1
Hi All,
Using Kivy I need to call a function by pressing a Button. At the moment this code work fine but only to end the program execution.

from kivy.uix.button import Button
....

b=(Button(text='Exit'))
Layout.add_widget(b)
b.bind(on_press=exit)
For example I would like to call a function for changing the text of a label.

Thanks in advance for your kind support.
Regards,

Giovanni
Reply
#2
Well you have bound that button to the exit function. If you want to do something else with that button write the function and bind it to that one instead. Otherwise create the function you want as well and create another button and bind that one to the new function.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Returning a value from a tkinter.button call markr0804 4 25,005 Feb-16-2020, 10:35 AM
Last Post: markr0804
  [PySimpleGui] How to alter mouse click button of a standard submit button? skyerosebud 3 4,949 Jul-21-2019, 06:02 PM
Last Post: FullOfHelp

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020