Skip to content
This repository has been archived by the owner on Nov 29, 2019. It is now read-only.

Having a param.String variable named name should error or at least warn #69

Open
ahuang11 opened this issue Jul 28, 2018 · 0 comments
Open

Comments

@ahuang11
Copy link

name = param.String(default='a name')

Here it's overlapping with CurveExample(name='HoloViews Example')

import param
import parambokeh
from bokeh.io import output_notebook
import numpy as np
import pandas as pd

output_notebook()
import holoviews as hv

class CurveExample(hv.streams.Stream):

    color = param.Color(default='#000000', precedence=0)

    element = param.ObjectSelector(default=hv.Curve,
                                   objects=[hv.Curve, hv.Scatter, hv.Area],
                                  precedence=0)

    amplitude = param.Number(default=2, bounds=(2, 5))
    
    frequency = param.Number(default=2, bounds=(1, 10))
    
    name = param.String(default='Hello')
    
    output = parambokeh.view.Plot()
    
    def view(self, *args, **kwargs):
        return self.element(self.amplitude*np.sin(np.linspace(0, np.pi*self.frequency)),
                        vdims=[hv.Dimension('y', range=(-5, 5))]).opts(style=dict(color=self.color)) * hv.Text(20, 3, self.name)
    
    def event(self, **kwargs):
        if not self.output or any(k in kwargs for k in ['color', 'element']):
            self.output = hv.DynamicMap(self.view, streams=[self], cache_size=0)
        else:
            super(CurveExample, self).event(**kwargs)

example = CurveExample(name='HoloViews Example')
parambokeh.Widgets(example, callback=example.event, on_init=True, view_position='right')

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant