Forum Archive

ui widget documentation question

wradcliffe

I am writing code for a generic property list sheet. I am wondering how users are finding out how to use the existing widgets. I have looked at all the code people have posted and keep finding things that are not in the docs. An example is that all the widgets like TextField and Switch take a frame using "frame = ". If the source for pythonista were available for browsing I could find this stuff out directly but there must be a way. Thanks for all developers posting code here. The Settings and SettingsSheet code has been very instructive.

Gerzer

All UI widgets are actually predefined ui.View objects and inherit (I think) all of ui.View's properties and attributes. So to see the documentation of the common frame attribute look at ui.View.frame.

Gerzer

Also, if you have any questions about how to do stuff, I would recommend posting on the forums specifically regarding one particular issue or emailing Ole Zorn directly.

dgelessus

Indeed, all UI elements are subclasses of ui.View and follow Python's standard inheritance rules.

@Gerzer, omz seems to check the forums regularly. Unless you need to discuss something that shouldn't be public, it's probably best to post on the forums instead of emailing Ole. Other people might be able to help and the solution will be visible to everyone afterwards.

wradcliffe

Thanks for clearing that up. I can see now that ui.View documents that all the widgets inherit from it. Should the documentation for each ui element reflect this by adding (ui.View) after the class name possibly with a link to the parent class?

I will do my own homework first by searching the forums and looking at other peoples code, post to the forums second, and only go direct to Ole as a last resort. That is working fine so far. I am new to Python and picked up Pythonista just a few weeks ago.

ccc

You can also go on a fishing expedition with Python Introspection.

Try typing each of the following lines in the Pythonisa console command line:

import ui
view = ui.View()
print(dir(view))
print(callable(view.frame))
print(callable(view.send_to_back))

import inspect
print(inspect.isbuiltin(view.bring_to_front))
print(inspect.getmembers(view))