Esempio n. 1
0
        def dbg(frame = slider(vmin=0, vmax=len(self._stack)-1-5, step_size=1, default=len(self._stack)-1-5, label='stack frame'),
                lines = slider(vmin=3, vmax=99, step_size=2, default=11, label='lines of context'),
                command = input_box("", label="", type=str),
                button = selector(['Evaluate'], label='', buttons=True)
                ):
            # Frame number 5 corresponds to the code which was
            # executed in the notebook cell.  The frames 0 to 4 are
            # notebook code and not that interesting to the user.
            frame = frame + 5

            if self._last is None:
                self._last = {'command':command, 'button':button, 'lines':lines, 'frame':frame}

            if self._last['lines'] != lines:
                # they dragged the number-of-lines slider, so done
                pass
            elif self._last['command'] != command and command.strip():
                # they changed the command, so evaluate that
                self.evaluate(command)
            elif self._last['frame'] != frame:
                # they dragged the frame slider.
                self._curframe_index = frame
            elif command:
                # must have hit the evaluate button
                self.evaluate(command)

            print '<html><hr>' + self.listing(lines//2) + '</html>'
            # save control state for next time around
            self._last = {'command':command, 'button':button, 'lines':lines, 'frame':frame}
Esempio n. 2
0
 def dbg(frame = slider(vmin=0, vmax=len(self._stack)-1-5, step_size=1, default=len(self._stack)-1-5, label='stack frame'),
         lines = slider(vmin=3, vmax=99, step_size=2, default=11, label='lines of context'),
         command = input_box("", label="", type=str),
         button = selector(['Evaluate'], label='', buttons=True)
         ):
     # Frame number 5 corresponds to the code which was
     # executed in the notebook cell.  The frames 0 to 4 are
     # notebook code and not that interesting to the user.
     frame = frame + 5
     
     if self._last is None:
         self._last = {'command':command, 'button':button, 'lines':lines, 'frame':frame}
         
     if self._last['lines'] != lines:
         # they dragged the number-of-lines slider, so done
         pass
     elif self._last['command'] != command and command.strip():
         # they changed the command, so evaluate that
         self.evaluate(command)
     elif self._last['frame'] != frame:
         # they dragged the frame slider.
         self._curframe_index = frame
     elif command:
         # must have hit the evaluate button
         self.evaluate(command)
         
     print '<html><hr>' + self.listing(lines//2) + '</html>'
     # save control state for next time around
     self._last = {'command':command, 'button':button, 'lines':lines, 'frame':frame}
Esempio n. 3
0
        def dbg(frame = slider(vmin=0, vmax=len(self._stack)-1, step_size=1, default=len(self._stack)-1, label='stack frame'),
                lines = slider(vmin=3, vmax=99, step_size=2, default=11, label='lines of context'),
                command = input_box("", label="", type=str),
                button = selector(['Evaluate'], label='', buttons=True)
                ):

            if self._last is None:
                self._last = {'command':command, 'button':button, 'lines':lines, 'frame':frame}

            if self._last['lines'] != lines:
                # they dragged the number-of-lines slider, so done
                pass
            elif self._last['command'] != command and command.strip():
                # they changed the command, so evaluate that
                self.evaluate(command)
            elif self._last['frame'] != frame:
                # they dragged the frame slider.
                self._curframe_index = frame
            elif command:
                # must have hit the evaluate button
                self.evaluate(command)

            print('<html><hr>{}</html>'.format(self.listing(lines//2)))
            # save control state for next time around
            self._last = {'command':command, 'button':button, 'lines':lines, 'frame':frame}
Esempio n. 4
0
        def dbg(frame = slider(vmin=0, vmax=len(self._stack)-1, step_size=1, default=len(self._stack)-1, label='stack frame'),
                lines = slider(vmin=3, vmax=99, step_size=2, default=11, label='lines of context'),
                command = input_box("", label="", type=str),
                button = selector(['Evaluate'], label='', buttons=True)
                ):

            if self._last is None:
                self._last = {'command':command, 'button':button, 'lines':lines, 'frame':frame}

            if self._last['lines'] != lines:
                # they dragged the number-of-lines slider, so done
                pass
            elif self._last['command'] != command and command.strip():
                # they changed the command, so evaluate that
                self.evaluate(command)
            elif self._last['frame'] != frame:
                # they dragged the frame slider.
                self._curframe_index = frame
            elif command:
                # must have hit the evaluate button
                self.evaluate(command)

            print('<html><hr>{}</html>'.format(self.listing(lines//2)))
            # save control state for next time around
            self._last = {'command':command, 'button':button, 'lines':lines, 'frame':frame}
Esempio n. 5
0
 def _(real_center=input_box(x_center, 'Real'),
     im_center=input_box(y_center, 'Imaginary'),
     width=input_box(image_width, 'Width of Image'),
     iterations=input_box(max_iteration, 'Max Number of Iterations'),
     level_sep=input_box(iteration_level, 'Iterations between Colors'),
     color_num=input_box(number_of_colors, 'Number of Colors'),
     image_color=color_selector(default=Color([j/255 for j in base_color]),
      label="Image Color", hide_box=True)):
     return fast_mandelbrot_plot(real_center, im_center, width,
      iterations, pixel_count, level_sep, color_num, image_color).show()
Esempio n. 6
0
        def _(cx = input_box(c_real, '$Re(c)$'),
            cy = input_box(c_imag, '$Im(c)$'),
            real_center=input_box(x_center, 'Real Center'),
            im_center=input_box(y_center, 'Imaginary Center'),
            width=input_box(image_width, 'Width of Image'),
            iterations=input_box(max_iteration, 'Max Number of Iterations'),
            level_sep=input_box(iteration_level, 'Iterations between Colors'),
            color_num=input_box(number_of_colors, 'Number of Colors'),
            image_color=color_selector(default=Color([j/255 for j in base_color]),
             label="Image Color", hide_box=True),
            pt_color=color_selector(default=Color([j/255 for j in point_color]),
             label="Point Color", hide_box=True),
            mandel=checkbox(mandelbrot, label='Mandelbrot set')):

            if mandel:
                return julia_helper(cx, cy, real_center, im_center,
                 width, iterations, pixel_count, level_sep, color_num,
                 image_color, pt_color).show()

            else:
                return fast_julia_plot(cx, cy, real_center, im_center,
                 width, iterations, pixel_count, level_sep, color_num,
                 image_color).show()
Esempio n. 7
0
        def dbg(
            frame=slider(
                vmin=0,
                vmax=len(self._stack) - 1 - 5,
                step_size=1,
                default=len(self._stack) - 1 - 5,
                label="stack frame",
            ),
            lines=slider(vmin=3, vmax=99, step_size=2, default=11, label="lines of context"),
            command=input_box("", label="", type=str),
            button=selector(["Evaluate"], label="", buttons=True),
        ):
            # Frame number 5 corresponds to the code which was
            # executed in the notebook cell.  The frames 0 to 4 are
            # notebook code and not that interesting to the user.
            frame = frame + 5

            if self._last is None:
                self._last = {"command": command, "button": button, "lines": lines, "frame": frame}

            if self._last["lines"] != lines:
                # they dragged the number-of-lines slider, so done
                pass
            elif self._last["command"] != command and command.strip():
                # they changed the command, so evaluate that
                self.evaluate(command)
            elif self._last["frame"] != frame:
                # they dragged the frame slider.
                self._curframe_index = frame
            elif command:
                # must have hit the evaluate button
                self.evaluate(command)

            print "<html><hr>" + self.listing(lines // 2) + "</html>"
            # save control state for next time around
            self._last = {"command": command, "button": button, "lines": lines, "frame": frame}