Ask Your Question
0

More Complex Interact Layout

asked 8 years ago

mcweihing gravatar image

updated 8 years ago

I know i can use layout to specify top, left, right, bottom. However, I've been able to figure out how to layout more than a few rows. For instance, I would like to place 5 rows each containing 1 textbox and 1 button side by side. Also, in between each row of button/textbox I would like to have additional text. Is this possible to do inside of one cell or will I have to get creative with it?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 8 years ago

How about something like this (live example here):

@interact(layout=[['a','b'],['t1'],['c','d'],['t2']])
def _(a=x^2, b=[1..3], c=-x ,d=[1..3],
      t1=text_control('Some text'), t2=text_control('Some other text') ):

        show(plot(a*b+c*d,0,3))

You can keep adding rows in this form of the layout. You can force the buttons closer to the input boxes by adding additional text controls after the buttons containing blank space: the automatic alignment appears to depend on the number of items in a row.

Preview: (hide)
link

Comments

Yes. Thank you so much. That's what I've been looking for

mcweihing gravatar imagemcweihing ( 8 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 8 years ago

Seen: 903 times

Last updated: Feb 23 '17