Make interface using design tool and edit it by script (add some ui elements). Is it possible?
I had made interface using design tool in Pythonista. And I need to edit "scrollview1" from script and add list of buttons. How can I do it?
May be it is imposible? If I make interface in design tool then I can only edit action script?
add_subview will work for scrollviews, but note to make it scrollable you need to set the content_size property. I think typically one would create a container View that is larger than the screen, and add that View as a subview of scrollview, rather than adding lots of subviews to the scrollview, though i think it can be done either way.
For a dictionary, you might take a look at TableView, which will give you better performance when you have many words.
I'll think about tableView. Thanks. But it will be later..
I touch the button, but nothing was heppend(.
# coding: utf-8 import ui def action_butt(sender): v=sender.superview myScrollView=v['scrollview1'] butt = ui.Button(title='test') myScrollView.add_subview(butt) v=ui.load_view('Untitled 5') v.present()
I need to understend the principle of work with views..
@cg-mag, it looks ok to me what you did. But look in ui designer and make sure you have the correct names. And also that you action field in the btn is just
@Phuket2, Yes I have correct names.
It is a simple scene. Where can i mistake?((
@cg-mag , what is the 'No Name' control on the picture? Is your scrollview1 at the front? I mean object layering? You have a menu to move to the front and back. Also is your scrollview apart if a subview in the form?
From your pics it looks correct to me. But, you are right, you really need to understand views. Might be time to take a step back and read about them in the included documentation.
It's the most fundamental thing you need to understand.
Let's say you scrollview is a subview of customview on the form called mycustomview. Then when you reference it you would need to do something like
v = sender.superview
scrollview = v['mycustomview']['scrollview1']
Sorry, I am trying to help, for me it's not clear what your problem is
No Name - it is not control. It is standart title... Scroll view I move to back. There obly 2 objects - scroll view and buuuton. All in the center with standart sizes.
Action from button have executed and I can change with this action for example content_size, but I can not add button!
I can change in scrollView anything, but can`t add new ui element
Maybe start a new project. Only put the scrollview and the button on the form. Maybe something will show up clearly
You are also right, it's a very easy example. So just start from scratch to be sure
I start new script and do this. I have the same
Ok, maybe I didn't see in the code version. Change the content size in the ui designer. Make the width and height the size of your screen.
Thank you a lot! Problem was in that - button was created but in left upper conner - very high. I move scroll view down and now all works right!!
Now I have new questions) - can i add 2 ui.label in each raw in table view?
@cg-mag , yes you can create ui.Labels in your ui.TableViews. But it has default ui.Labels built in already. You can do so much with ui.TableView, but it's worth the time reading first, it will save you a lot of time. It looks more difficult than it is.
Hard for me to reply fast at the moment. Floods every where and electric on and off. 3G is really bad. Maybe many people using it.
@cg-mag, no problems. I have been working on a menu creating program for my friend. I haven't done much, but from the screenshot below you can see you can do a lot with the TableView.