Whats wrong with this code?
I wrote this ui code, but the button isnt showing up. What's up?
Here's the code:
import ui def pressed (sender): sender.tint_color = 1.00, 0.00, 0.00 view = ui.View() view.name = "tic tac toe" view.background_color = 0.90, 0.90, 0.90 view.present("sheet") button = ui.Button() button.flex = "LRTB" button.action = pressed view.add_subview(button) button.center = (view.width *0.5,view.height *0.5) button.title = "nothing" button.background_image = ui.Image('Ant')
When you create a button without a title or icon, it gets a zero width/height, which makes it invisible. You'd either have to set the size explicitly, or pass a title to the constructor:
button = ui.Button(title='nothing')
Your next problem will probably be that the background image doesn't show up. Use
ui.Image('Ant')to fix that.