This is a program I wrote which is supposed to change a button's image from a smiley face to an ant when the face is touched. When I ran it, it did change, but also kept the face image. How do I get it so that it gets rid of the face when the image is touched?
Here's the code:
#coding: utf-8
import ui
def pressed (sender):
sender.tint_color = 1.00, 0.00, 0.00
button1.background_image = ui.Image.named('Ant')
view = ui.View()
view.name = "tic tac toe"
view.background_color = 0.90, 0.90, 0.90
view.present("sheet")
button1 = ui.Button(title = "😄")
button1.flex = "LRTB"
button1.action = pressed
view.add_subview(button1)
button1.center = (view.width *0.5,view.height *0.5)
button1.font = ('AmericanTypewriter-Condensed', 60)
button1.size_to_fit()
Thanks!