Is it possible to have custom bokeh models displayed inside jupyter-lab or notebooks? Currently, I get an Javascript Error when trying to do so, e.g. evaluating the Custom Draw Tool example inside a notebook, bokeh will complain about:
Javascript Error: Model 'DrawTool' does not exist. This could be due to a widget
or a custom model not being registered before first usage.
Yes, it is possible. But you will need to call output_notebook again (or for the first time) after you define the custom model. Otherwise it will not be registered with the BokehJS runtime (i.e. BokehJS will not know it exists).
Related
I was wondering if it is possible to get a list of windows in Tk, and destroy specific ones. I am working in R using the tcltk interface, and am calling a function written by someone else a long time ago (that I cannot edit) which is producing additional windows that I don't want.
From the documentation here, it seems that new Toplevel windows are children of .TkRoot by default. I know that Python has a winfo_children method, which I was thinking of trying to call on .TkRoot but I don't think that method is implemented in the tcltk library. I tried using tcl("winfo", "children", .TkRoot) but I am getting an error: [tcl] bad window path name "{}" (I'm not familiar with actual tcl, so I'm probably messing this command up).
Additionally, if there is a way to call winfo children, what's the best way to process the result to identify specific windows and then destroy them?
Looking at the R sources, I see that you should be doing:
tkwinfo("children", .TkRoot)
Except that I think that won't work either, as .TkRoot doesn't have a corresponding widget on the Tk side of things. Instead, use the string consisting of a single period (.) as the root of the search; that's the name for the initial window on the Tcl side of things. And I suspect that you'll just get back a raw Tcl list of basic Tk widget names without the R wrapping as I just can't see where that conversion is applied…
Be aware that the results may include widgets that you don't expect, and that you need to call it on every window recursively if you want to find everything.
I am currently using meteorhacks:ssr along with wkhtmltopdf in order to generate downloadable pdfs within my Meteor app. It is working end-to-end, which is great, apart from one last element.
The template helpers which have been specified in packages across my app, are not visible. From the examples in the documentation for SSR it uses templates and helpers specified at a super-package level, which is not feasible with a package based arrangement for an app.
The only way I can see to make them available both client and server-side is to store the functions in an object, and then to loop through the helper functions in client and server code to render the functions accessible in both places.
That methodology works, but it is rather lacking in beauty. Does anyone have any other experience/ideas with this?
In Symfony I see various commands for generating empty classes,bundles, entities etc.
I searched to generate a empty class for the creation process of custom console commands. But I couldn't.
May I know whether any commands are available in Symfony to generate empty classes for creating custom console command ?
If not, May I know whether it was restricted for any reasons ?
Note: Currently Now, I copied the codes from the symfony.com and edited accordingly.
There is no such command but you can write one by yourself if you like. I would not use it myself i think because generating an empty class is not much work to do.
I have a Bokeh chart in a Jupyter notebook, and I want to run custom Python whenever the Bokeh selection changes. It is very easy to run custom Javascript whenever the Bokeh selection changes using a source change callback, but I have no way to trigger Jupyter to respond to the event.
I think it is possible but poorly documented (see http://docs.bokeh.org/en/latest/docs/user_guide/server.html) to run a separate Bokeh server to receive the events. I want to avoid running a separate Bokeh server since the Jupyter server is already running.
I think you have to look at holoview.
It is design for this. You can choose between different renderers : matpotlib, bokeh, plotly.
You can either use their methodology for simple plots or if it is more specific you can run bokeh apps.
As you can see almost all examples of bokeh are ported to holoviews
Regards
This seems like a two-way communication between Bokeh object and Jupyter: https://docs.bokeh.org/en/latest/docs/user_guide/jupyter.html#notebook-handles
Import standard functions and push_notebook()
Create some plots and pass notebook_handle=True to show()
Check that the handle is associated with the output cell
Update some properties of the plot, then call push_notebook() with the handle
Note that the output cell has changed (without being re-executed)
You might have to poll the variable you want to catch changing, as this does not look like an event handler, just mutual exposure.
I want to attach YUI modules synchronously.
Given the YUI modules are already on the page
When I run: console.log YUI().use('base').Base
Then I get `undefined`
However,
When I run: YUI().use('base', (Y) -> console.log Y.Base)
Then I eventually get the Y.Base ctor function
It looks like loader is attaching async as it works fine using the callback method. IIRC the first method is supposed to work too though. What am I missing?
If you're using YUI in a controlled environment like Node.js, then you should be able to use useSync configuration:
YUI({ useSync: true }).use('base').Base
But in a browser, or any other client runtime you should stick to the asynchronous nature of Y.use so loader can do its job of computing the proper list of modules to be attached based on the feature detections etc. Having the modules included manually in the pase is just not enough. Imagine the scrollview-base in IE, which requires an special module called scrollview-base-ie, unless you do detection when building the initial markup that includes that module only when running in IE, you will have a missing module. Again, stick to the asynchronous pattern when loading stuff.
YUI modules really want to be called through a Y object in a callback. If you know for sure that all the code you need is loaded on the page, you can attach them all synchronously with a use *. See https://github.com/evangoer/yui3-cookbook/blob/master/examples/loading/use_synchronous.html for an example.