Forum Archive

How do I (or how can I) add a separator line in the ui editor?

ltddev

Using the ui editor, is there a way to add a separator line such as you see on many settings pages in iOS (including, I believe, Pythonista's own settings page) ? I am creating a custom view which contains a number of settings with check boxes and toggle switches and other controls. I would like to add a separator line between various settings to break the ui into meaningful groups. As a hack I am using a label whose text attribute is a continuous underline character.

zipit

As far as I know Pythoniastandoes not expose a specific control (or View in Pyhthonistas terms) for that. There is also nothing like 4sided borders so that you could draw a (0,0,0,1) border. I did it recently by just adding an ui.View with thei height of 1 in the places I did need a border.

JonB

have you looked at the dialogs module? The form_dialog can make settings type ui's.


from dialogs import *

dead={'type':'switch','title':'dead'}
resting={'type':'switch','title':'resting'}
stunned={'type':'switch','title':'just stunned'}
section1=('Parrot',[dead, resting, stunned] )

spam={'type':'switch','title':'spam'}
spamity={'type':'switch','title':'spam'}
spaM={'type':'switch','title':'spam'}
section2=('Spam',[spam, spamity, spaM],'SpammitySpam' )


f = form_dialog(title='Python Settings', sections=
    [section1, section2])

As to your original question, you can use an imageview with an image of a line that you stretch out. Also, you could use a custom view with drawing, but that requires code, cannot really layout in ui editor.