Forum Archive

Subviews in UI

AtomBombed

"ui.load_view().subviews[!!!].text"

I want to be able to use the space in the brackets with "!!!", and figure out a way to call a view under the parent view which in this case is a TextView which I want to find the text for. But it keeps saying "coercing to Unicode or buffer object. Int received instead.". When I print out the subviews, it gives me all of the subviews likes this: "_ui.TextView object at (random text here)".

Any coded answers would be great! If more detail is needed, just tell me. I understand this is a bit of a confusing description.

ccc
view = ui.load_view()
view['textview1'].text = 'Yo'
view.present()

The random text is not random at all. It is the address in memory of the subview. Instead of print subview, try print subview.name or subview.title or subview.text or subview.frame. You can print dir(subview) to see all members available.

AtomBombed

Nevermind, I answered this question. Thanks though if you were willing to help out!