donnieh
Jun 10, 2015 - 08:47
Can a ui.button have text that wraps many lines? I can only get it to be one line...
Can a ui.button have text that wraps many lines? I can only get it to be one line...
little known fact: buttons are views, and can have subviews.
use a Label, as a subview of a button. see for example:
# coding: utf-8
import ui,faker
f=faker.Faker()
v=ui.View(frame=(0,0,576,576))
b=ui.Button(frame=(100,200,200,100),bg_color='#ffede7')
lbl=ui.Label(frame=(0,0,200,100),name='button_label')
lbl.number_of_lines=0
lbl.alignment=ui.ALIGN_CENTER
def a(sender):
sender['button_label'].text=f.sentence()
b.action=a
b.add_subview(lbl)
v.add_subview(b)
v.present('sheet')
Ooooh. Now that's interesting....