ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 23 Feb 2017 09:09:17 -0600More Complex Interact Layouthttps://ask.sagemath.org/question/36697/more-complex-interact-layout/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?Wed, 22 Feb 2017 15:07:40 -0600https://ask.sagemath.org/question/36697/more-complex-interact-layout/Answer by paulmasson for <p>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?</p>
https://ask.sagemath.org/question/36697/more-complex-interact-layout/?answer=36704#post-id-36704How about something like this ([live example here](http://sagecell.sagemath.org/?z=eJxtjMEKwjAQRO-F_sPeNtG12PYmBPwHjyGWNIlUqF2pK9a_V6u9OZdh3gyzPw-SRh9E9f7JdzHWokfCFh1ZlHK28AbxCyp0TudZTCdolDfTsSJojS2LonYEwWwmoLjkPINZUhpJkzSBBxm5V3jgS4IPQk0g1b-WpUvjbwN6l2fLGcCt44e69izKr9p1WEXaUq31C4v2Ojc=&lang=sage)):
@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.Wed, 22 Feb 2017 19:43:04 -0600https://ask.sagemath.org/question/36697/more-complex-interact-layout/?answer=36704#post-id-36704Comment by mcweihing for <p>How about something like this (<a href="http://sagecell.sagemath.org/?z=eJxtjMEKwjAQRO-F_sPeNtG12PYmBPwHjyGWNIlUqF2pK9a_V6u9OZdh3gyzPw-SRh9E9f7JdzHWokfCFh1ZlHK28AbxCyp0TudZTCdolDfTsSJojS2LonYEwWwmoLjkPINZUhpJkzSBBxm5V3jgS4IPQk0g1b-WpUvjbwN6l2fLGcCt44e69izKr9p1WEXaUq31C4v2Ojc=&lang=sage">live example here</a>):</p>
<pre><code>@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))
</code></pre>
<p>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.</p>
https://ask.sagemath.org/question/36697/more-complex-interact-layout/?comment=36712#post-id-36712Yes. Thank you so much. That's what I've been looking forThu, 23 Feb 2017 09:09:17 -0600https://ask.sagemath.org/question/36697/more-complex-interact-layout/?comment=36712#post-id-36712