Ask Your Question
0

More Complex Interact Layout

asked 2017-02-22 22:07:40 +0100

mcweihing gravatar image

updated 2017-02-22 22:08:37 +0100

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-02-23 02:43:04 +0100

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.

edit flag offensive delete link more

Comments

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

mcweihing gravatar imagemcweihing ( 2017-02-23 16:09:17 +0100 )edit

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: 2017-02-22 22:07:40 +0100

Seen: 795 times

Last updated: Feb 23 '17