How to do upload my interactive bokeh maps I created on a website? I read the documentation and used the file_html function to create the html code, but all the functionality does not work like the select drop down, and sliders. What is the best way to share it on a website?
This is the warning I received.
This is the Warning I received. WARNING:bokeh.embed.util: You are generating
standalone HTML/JS output, but trying to use real Python callbacks (i.e.
with on_change or on_event). This combination cannot work. Only JavaScript
callbacks may be used with standalone output. For more information on
JavaScript callbacks with Bokeh , see:
http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html
I tried to make that error message as self-contained as possible. I am not sure what else can be added to it, but suggestions are welcome. There are two scenarios:
Standalone output
This is purely HTML and JS content, that has no connection with any running python process. It is most often generated with output_file and show (or save), but it's also what you get if you use the lower level file_html function. Since there is no Python process anywhere after the output is created, there is no possible way for "real" Python callbacks to function, at all. In this case, the only possible callbacks that can work are JavaScript ones, e.g. CustomJS added with js_on_change or js_on_event. That's because the browser viewing the (purely HTML and JS) content does not know anything about Python, it only knows about JavaScript.
Bokeh Server Applications
This is a continuously running Bokeh server that serves Bokeh content, and,
most crucially: maintains an active connection to that content. That means that when some event happens, e.g. a slider changes, the Bokeh server can run real Python callback code in response. That is, in fact, the primary reason the Bokeh server exists: to be the thing that runs real Python code for an on_change or on_event callbacks. If you want to run real Python code (e.g. Numpy or Pandas or whatever) in response to events, you must run a Bokeh server.
Right click on the generated site in a web browser and select "Inspect". Then open the "console" tab and you list of errors will be detailed there. My guess is that you are not referencing a javascript file correctly.
Related
I have a Flask app that render some page on localhost:3000. To display correctly this page on every computer i use chromium browser (Basically WXpython example from cefpython3 with minor changes: https://github.com/cztomczak/cefpython/blob/master/examples/wxpython.py). However on some computers that have a different resolution/zoom level i have to re-run the code with a different value of parameter 'auto_zooming' in order to display correctly the page:
...
zoom = '0'
settings = {'debug': False, 'auto_zooming': zoom}
cef.Initialize(settings=settings)
...
My question is: There is any way to change the zoom level of Cefpython browser without have to rerun the code everytime i want to change the zoom? I was thinking on something like 'ctrl - +' or 'ctrl - -'.
Thanks in advance,
Ricardo
Can't you detect zoom level before initializing CEF?
The auto_zooming option will call SetBrowserDpiSettings C++ function. It sets zoom level constantly in a 50 ms timer. You can implement similar functionality in pure Python. It uses four functions and their Python equivalents are: Browser.SetZoomLevel, Browser.GetZoomLevel, cef.DpiAware.GetSystemDpi and cef.PostDelayedTask.
See the C++ function source code here:
https://github.com/cztomczak/cefpython/blob/6f5bf081fec19647e1860bb3e0f3638c02bb9d11/src/client_handler/dpi_aware.cpp#L163
So I've been trying to learn Bokeh recently and everything was going well but suddenly whenever I try and make a Bokeh plot the browser just shows a blank page. I get no error codes just the blank page. This is with programs that I was successfully using to create plots just a couple days ago. I even tried loading a html plot file I'd made a few weeks ago that had worked on co-workers computers and got the same result. I even tried one of the basic example code and got the same blank page.
from bokeh.plotting import figure, output_file, show
p = figure(title="line", plot_width=300, plot_height=300)
p.line(x=[1, 2, 3, 4, 5], y=[6, 7, 2, 4, 5])
show(p)
Never thought to try it but do standard Bokeh plots work if you are not online? Does it callout to an external server to generate the plots and maybe now some IT changes at my work are preventing the plots from being generated?
Thanks for any help!
It does not call out to an external server, but it does require the browser to load a JavaScript library, BokehJS. By default (and by popular demand) BokehJS is loaded remotely from a CDN (specifically, from https://cdn.bokeh.org). Accordingly, viewing a Bokeh plot that is configured to use CDN resource requires an active and working network connection.
But it's possible to use "inline" resources, which means the BokehJS library is included directly in the HTML output that Bokeh (the python library) generates. The easiest way to to do this is to set the environment variable:
BOKEH_RESOURCES=inline
There are other ways to specify resources, though, too. For more details see the documentation.
As an aside, in a situation like this it is helpful to consult your browser's JavaScript console. If the CDN resources can't be loaded, you will see the error there.
How can I force refresh in structure view or enable autorefresh in Pycharm. After any code update clicking on function does not work anymore (should jump to function code). Only possibility is to hide and show view but it loose context and I need search function name again what is bad idea with larger code.
Essentially what I want to do is be able to click a button and have the webpage state be stored somewhere on the HDD so it doesn't need to just sit in RAM, and when it's loaded again at some later time the page pops up exactly as it was before as if it had never been closed without the need to download anything over the internet to restore it (although additional resource requests that didn't exist when the page was saved should still download properly).
(as an example, firefox does this when it crashes, all the tabs are restored, text you've typed is still in the textboxes, etc..)
I don't care if that button is in a firefox plugin, chrome, or even a custom browser that I program myself with something like webkit perhaps.
I've been trying for days to find a way to do this. I made WebKit programs in both C++ and Python but every time I think I'm getting close there is some deficiency in webkit or a build-in security measure that prevents me from doing this. I tried creating MHTML archives but they don't allow javascript to download new data over the internet, I tried pickling the entire WebKit.WebView object in python, I tried looking through webkit code to see if I could patch the behavior into the source code myself
I'm running out of ideas and the only one I see left is to just post this online. Is there any way that I can do this, in any programming or scripting language, using any libraries at all?
I just have no idea where to turn next.
I am writing an editor which has lot of parameters that could be easily interacted with through text. I find it inconvenient to implement a separate text-editor or lots of UI code for every little parameter. Usual buttons, boxes and gadgets would be burdensome and clumsy. I'd much rather let user interact with those parameters through vim.
The preferable way for me would be to get editor open vim with my text buffer. Then, when one would save the text buffer in vim, my editor would get notified from that and update it's view.
Write your intermediate results (what you want the user to edit) to a temp file. Then use the $EDITOR environment variable in a system call to make the user edit the temp file, and read the results when the process finishes.
This lets users configure which editor they want to use in a pseudo-standard fashion.
Check out It's All Text!. It's a Firefox add-in that does something similar for textareas on web pages, except the editor in question is configurable.
You can also think about integrating VIM in to your app. Pida does this