Forum Archive

Accessing sub views

donnieh

I have a webview library object (named webview1) placed on the .pyui canvas. It's from the Pythonista gui editor library. I access this with the code below.

How do I access this same webview object if it is placed as a subview in a scrollview named scrollview1?

import ui

view1 = ui.load_view()

w1 = view1['webview1']

w1.load_url('http://www.yahoo.com')

view1.present()

dgelessus

All subviews are accessed in the same way, no matter if it's a normal View, a ScrollView, or something else. In your case that would be view1['scrollview1']['webview1'].

(I'm not sure why you'd want to place a WebView inside a ScrollView... the WebView is already scrollable on its own.)

donnieh

Thank you. Worked good. I appreciate the quick response.

Yes your right, dgelessus. You normally wouldn't want a web view inside a scroll view. For my I app I am doing so. I want a few small web views running at once that can be scrolled. This is productivity web browsing app. Think of how You Tube has it's videos listed in a scroll view.