Ticket #3636: trac3636_2.patch
| File trac3636_2.patch, 2.2 kB (added by itolkov, 4 months ago) |
|---|
-
a/sage/server/notebook/interact.py
old new 1473 1473 ... show(plot(sin(a*x+b), (x,0,6)), figsize=3) 1474 1474 <html>... 1475 1475 1476 Place a block of text among the controls: 1477 sage: @interact 1478 ... def _(t1=text_control("Factors an integer."), n="1"): 1479 ... print factor(Integer(n)) 1480 <html>... 1481 1476 1482 You do not have to use interact as a decorators; you can also 1477 1483 simply write \code{interact(f)} where f is any Python function 1478 1484 that you have defined, though this is frowned on. E.g., f can … … 1484 1490 DEFAULTS: 1485 1491 Defaults for the variables of the input function determine 1486 1492 interactive controls. The standard controls are \code{input_box}, 1487 \code{slider}, \code{checkbox}, \code{selector}, and 1488 \code{input_grid}. There is also a color selector (see defaults below). 1493 \code{slider}, \code{checkbox}, \code{selector}, 1494 \code{input_grid}. There is also a color selector and text control 1495 (see defaults below). 1489 1496 1490 1497 \begin{itemize} 1491 1498 \item u = input_box(default=None, label=None, type=None) … … 1501 1508 \item u = input_grid(nrows, ncols, default=None, label=None, 1502 1509 to_value=lambda x:x, width=4) 1503 1510 -- an editable grid of objects (a matrix or array) 1504 1511 \item u = text_control(value='') 1512 -- a block of text 1505 1513 \end{itemize} 1506 1514 1507 1515 You can create a color selector by setting the default value for a … … 2389 2397 buttons=self.__buttons) 2390 2398 2391 2399 class text_control(control): 2392 def __init__(self, value ):2400 def __init__(self, value=''): 2393 2401 """ 2394 2402 Text that can be inserted among other interact controls. 2395 2403