Button objects can be pressed by the user.
Pressing a Button calls a function. Which function to call is specified when the button is created.
The following function creates a new Button, so you need to save it in a variable (so you can use it later).
|Button(text, function)||Creates a new button containing text (a string).Every time the button is pressed, function is called automatically. This function should expect zero parameters.|
For example, a button may be created as follows:
button1 = Button("Play music", playMusic)
where playMusic is a function with zero parameters. This function will be called automatically when the user presses this button.
Once a Button has been created, it may be added to a Display specifying where to place its top-left corner.
d.add(button1, 50, 50)