Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Struggling to UI a grid of fields
-
def fieldEdited(sender): t=view[fieldName].text print t for loop in range(1,11): #print loop fieldName='field' + str(loop) view = ui.View() view.background_color = 'white' field = ui.TextField() print fieldName field.name='field'+str(loop) field.text= fieldName field.center = (70,(90+loop*30)) field.height=27 field.width=82 field.action = fieldEdited view.add_subview(field) view.present(style='full_screen',hide_title_bar='True')```
-
Please polymerchm could you save me?!
-
In your action,
sender.name
returns the name of the textview you have edited. -
put the first three back ticks on their own line immediately followed by
python
. After all the code, on its own line, three more backticks -
Sorry it just displays very badly, it does not like my Apple Mac text.
-
blank line three backticks python<return!!!> your code three backticks
You can edit any of your existing posts by clicking
edit
at the upperright of the post. -
import ui def fieldEdited(sender): t=view[fieldName].text print t for loop in range(1,11): #print loop fieldName='field' + str(loop) view = ui.View() view.background_color = 'white' field = ui.TextField() print fieldName field.name='field'+str(loop) field.text= fieldName field.center = (70,(90+loop*30)) field.height=27 field.width=82 field.action = fieldEdited view.add_subview(field) view.present(style='full_screen',hide_title_bar='True')
-
Thank you ccc, who would have thought I could make such a mess of it?
Now can anybody solve my original problem, it's a long way back.
-
import ui def fieldEdited(sender): t=sender.text # note change print t view = ui.View() view.background_color = 'white' for loop in range(1,11): #print loop fieldName ='field' + str(loop) field = ui.TextField() field.name = fieldName field.text= 'type something' field.center = (70,(90+loop*30)) field.height=27 field.width=82 field.action = fieldEdited view.add_subview(field) view.present(style='full_screen',hide_title_bar='True')
-
Wow, thanks. A simple as that, and no doubt after a lot of experience on your part. Thanks.