Example Code how to embed html in Python script

Hello everyone,

Can anyone provide a small example of how to ingest HTML in Python script while running on server?

Thanks,

Pratik

Hi,

Can you describe describe exactly what you are looking for? Returning information back to the python while on the server, or rendering an html file? There are different methods and it depends on what you want to do. You can use forms, url query strings, AJAX,…

···

On Wednesday, January 11, 2017 at 12:22:04 PM UTC-5, [email protected] wrote:

Hello everyone,

Can anyone provide a small example of how to ingest HTML in Python script while running on server?

Thanks,

Pratik

Hi,

Sorry. Let me change my question and be more clear. I would like to render actually a .js file rather than html. Any examples or suggestions on that?

Thanks,

Pratik

···

On Thursday, 12 January 2017 10:10:47 UTC-5, javbo wrote:

Hi,

Can you describe describe exactly what you are looking for? Returning information back to the python while on the server, or rendering an html file? There are different methods and it depends on what you want to do. You can use forms, url query strings, AJAX,…

On Wednesday, January 11, 2017 at 12:22:04 PM UTC-5, [email protected] wrote:

Hello everyone,

Can anyone provide a small example of how to ingest HTML in Python script while running on server?

Thanks,

Pratik

Perhaps you are looking for autoload_static:

  http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data

Bryan

···

On Jan 12, 2017, at 3:31 PM, [email protected] wrote:

Hi,

Sorry. Let me change my question and be more clear. I would like to render actually a .js file rather than html. Any examples or suggestions on that?

Thanks,
Pratik

On Thursday, 12 January 2017 10:10:47 UTC-5, javbo wrote:
Hi,

Can you describe describe exactly what you are looking for? Returning information back to the python while on the server, or rendering an html file? There are different methods and it depends on what you want to do. You can use forms, url query strings, AJAX,..

On Wednesday, January 11, 2017 at 12:22:04 PM UTC-5, pratik...@gmail.com wrote:
Hello everyone,

Can anyone provide a small example of how to ingest HTML in Python script while running on server?

Thanks,
Pratik

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/41c72e07-1c01-45c0-96e9-7f2b7ceacf75%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Now, is this going to work with Bokeh server too?

···

On Thursday, 12 January 2017 16:47:51 UTC-5, Bryan Van de ven wrote:

Perhaps you are looking for autoload_static:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data](http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data)

Bryan

On Jan 12, 2017, at 3:31 PM, [email protected] wrote:

Hi,

Sorry. Let me change my question and be more clear. I would like to render actually a .js file rather than html. Any examples or suggestions on that?

Thanks,

Pratik

On Thursday, 12 January 2017 10:10:47 UTC-5, javbo wrote:

Hi,

Can you describe describe exactly what you are looking for? Returning information back to the python while on the server, or rendering an html file? There are different methods and it depends on what you want to do. You can use forms, url query strings, AJAX,…

On Wednesday, January 11, 2017 at 12:22:04 PM UTC-5, [email protected] wrote:

Hello everyone,

Can anyone provide a small example of how to ingest HTML in Python script while running on server?

Thanks,

Pratik


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/41c72e07-1c01-45c0-96e9-7f2b7ceacf75%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

No, if you are trying to embed apps from a server you'd normally want autoload_server. That won't render a JS file tho. it will only provide a script tag for you to use. Server apps live in the server, and automatically reflect into the browser. There is no separate .js file involved that users would see or need. I'm not sure I'm clear on what you are trying to accomplish.

Thanks,

Bryan

···

On Jan 12, 2017, at 3:52 PM, [email protected] wrote:

Now, is this going to work with Bokeh server too?

On Thursday, 12 January 2017 16:47:51 UTC-5, Bryan Van de ven wrote:
Perhaps you are looking for autoload_static:

        http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data

Bryan

> On Jan 12, 2017, at 3:31 PM, pratik...@gmail.com wrote:
>
> Hi,
>
> Sorry. Let me change my question and be more clear. I would like to render actually a .js file rather than html. Any examples or suggestions on that?
>
> Thanks,
> Pratik
>
> On Thursday, 12 January 2017 10:10:47 UTC-5, javbo wrote:
> Hi,
>
> Can you describe describe exactly what you are looking for? Returning information back to the python while on the server, or rendering an html file? There are different methods and it depends on what you want to do. You can use forms, url query strings, AJAX,..
>
> On Wednesday, January 11, 2017 at 12:22:04 PM UTC-5, pratik...@gmail.com wrote:
> Hello everyone,
>
> Can anyone provide a small example of how to ingest HTML in Python script while running on server?
>
> Thanks,
> Pratik
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/41c72e07-1c01-45c0-96e9-7f2b7ceacf75%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/704c1c7f-16b0-4e1d-9079-8cb2d09d7ee0%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

So, I am trying to learn to embed a widget which is a .js function. Trying to see how those external js functions can be used.

Any examples that you could provide, Bryan?

Thanks,

Pratik

···

On Thursday, 12 January 2017 17:09:44 UTC-5, Bryan Van de ven wrote:

No, if you are trying to embed apps from a server you’d normally want autoload_server. That won’t render a JS file tho. it will only provide a script tag for you to use. Server apps live in the server, and automatically reflect into the browser. There is no separate .js file involved that users would see or need. I’m not sure I’m clear on what you are trying to accomplish.

Thanks,

Bryan

On Jan 12, 2017, at 3:52 PM, [email protected] wrote:

Now, is this going to work with Bokeh server too?

On Thursday, 12 January 2017 16:47:51 UTC-5, Bryan Van de ven wrote:

Perhaps you are looking for autoload_static:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data](http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data)

Bryan

On Jan 12, 2017, at 3:31 PM, [email protected] wrote:

Hi,

Sorry. Let me change my question and be more clear. I would like to render actually a .js file rather than html. Any examples or suggestions on that?

Thanks,
Pratik

On Thursday, 12 January 2017 10:10:47 UTC-5, javbo wrote:
Hi,

Can you describe describe exactly what you are looking for? Returning information back to the python while on the server, or rendering an html file? There are different methods and it depends on what you want to do. You can use forms, url query strings, AJAX,…

On Wednesday, January 11, 2017 at 12:22:04 PM UTC-5, [email protected] wrote:
Hello everyone,

Can anyone provide a small example of how to ingest HTML in Python script while running on server?

Thanks,
Pratik


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/41c72e07-1c01-45c0-96e9-7f2b7ceacf75%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/704c1c7f-16b0-4e1d-9079-8cb2d09d7ee0%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi,

The question does not make sense to me as stated (I'm not sure what "embed a widget which is a .js function" means in this context).

If you mean that you want to attach JS code to Bokeh widgets, this might be useful:

  http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html#userguide-interaction-callbacks

If you mean you want to take a third party JS library and extend Bokeh so it can be used in Bokeh documents, then perhaps this:

  http://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html

Thanks,

Bryan

···

On Jan 12, 2017, at 8:47 PM, [email protected] wrote:

So, I am trying to learn to embed a widget which is a .js function. Trying to see how those external js functions can be used.

Any examples that you could provide, Bryan?

Thanks,
Pratik

On Thursday, 12 January 2017 17:09:44 UTC-5, Bryan Van de ven wrote:
No, if you are trying to embed apps from a server you'd normally want autoload_server. That won't render a JS file tho. it will only provide a script tag for you to use. Server apps live in the server, and automatically reflect into the browser. There is no separate .js file involved that users would see or need. I'm not sure I'm clear on what you are trying to accomplish.

Thanks,

Bryan

> On Jan 12, 2017, at 3:52 PM, pratik...@gmail.com wrote:
>
> Now, is this going to work with Bokeh server too?
>
> On Thursday, 12 January 2017 16:47:51 UTC-5, Bryan Van de ven wrote:
> Perhaps you are looking for autoload_static:
>
> http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data
>
> Bryan
>
> > On Jan 12, 2017, at 3:31 PM, pratik...@gmail.com wrote:
> >
> > Hi,
> >
> > Sorry. Let me change my question and be more clear. I would like to render actually a .js file rather than html. Any examples or suggestions on that?
> >
> > Thanks,
> > Pratik
> >
> > On Thursday, 12 January 2017 10:10:47 UTC-5, javbo wrote:
> > Hi,
> >
> > Can you describe describe exactly what you are looking for? Returning information back to the python while on the server, or rendering an html file? There are different methods and it depends on what you want to do. You can use forms, url query strings, AJAX,..
> >
> > On Wednesday, January 11, 2017 at 12:22:04 PM UTC-5, pratik...@gmail.com wrote:
> > Hello everyone,
> >
> > Can anyone provide a small example of how to ingest HTML in Python script while running on server?
> >
> > Thanks,
> > Pratik
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> > To post to this group, send email to bo...@continuum.io.
> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/41c72e07-1c01-45c0-96e9-7f2b7ceacf75%40continuum.io\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/704c1c7f-16b0-4e1d-9079-8cb2d09d7ee0%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/cc91bd67-75ce-41d4-86a6-78458d059968%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan,

Thank you for the response. Based on the first link, I tried to do something like below. What am I doing wrong here?

from bokeh.models import CustomJS

callback = CustomJS(args = dict(datepicker=datepicker), code=“”"

						<!doctype html>

						<html lang="en">

						<head>

						  <meta charset="utf-8">

						  <meta name="viewport" content="width=device-width, initial-scale=1">

						  <title>jQuery UI Datepicker - Display month &amp; year menus</title>

						  <link href="jquery-ui/jquery-ui.structure.min.css" rel="stylesheet" type="text/css"/>

						  <link href="jquery-ui/jquery-ui.theme.min.css" rel="stylesheet" type="text/css"/>

						  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>

						  <script src="jquery-ui/jquery-ui.min.js"></script>

						  <script>

						  $( function() {

							$( "#datepicker" ).datepicker({

							  changeMonth: true,

							  changeYear: true

							});

						  } );

						  </script>

						</head>

						<body>

						<p>Date: <input type="text" id="datepicker"></p>

						</body>

						</html>

“”")

datepicker = DatePicker(title=“Date”, callback = callback)

curdoc().add_root(datepicker)

I am unsure as to what will go in the args bracket? This is just the calendar widget.

···

On Friday, 13 January 2017 12:04:04 UTC-5, Bryan Van de ven wrote:

Hi,

The question does not make sense to me as stated (I’m not sure what “embed a widget which is a .js function” means in this context).

If you mean that you want to attach JS code to Bokeh widgets, this might be useful:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html#userguide-interaction-callbacks](http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html#userguide-interaction-callbacks)

If you mean you want to take a third party JS library and extend Bokeh so it can be used in Bokeh documents, then perhaps this:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html](http://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html)

Thanks,

Bryan

On Jan 12, 2017, at 8:47 PM, [email protected] wrote:

So, I am trying to learn to embed a widget which is a .js function. Trying to see how those external js functions can be used.

Any examples that you could provide, Bryan?

Thanks,

Pratik

On Thursday, 12 January 2017 17:09:44 UTC-5, Bryan Van de ven wrote:

No, if you are trying to embed apps from a server you’d normally want autoload_server. That won’t render a JS file tho. it will only provide a script tag for you to use. Server apps live in the server, and automatically reflect into the browser. There is no separate .js file involved that users would see or need. I’m not sure I’m clear on what you are trying to accomplish.

Thanks,

Bryan

On Jan 12, 2017, at 3:52 PM, [email protected] wrote:

Now, is this going to work with Bokeh server too?

On Thursday, 12 January 2017 16:47:51 UTC-5, Bryan Van de ven wrote:
Perhaps you are looking for autoload_static:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data](http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data)

Bryan

On Jan 12, 2017, at 3:31 PM, [email protected] wrote:

Hi,

Sorry. Let me change my question and be more clear. I would like to render actually a .js file rather than html. Any examples or suggestions on that?

Thanks,
Pratik

On Thursday, 12 January 2017 10:10:47 UTC-5, javbo wrote:
Hi,

Can you describe describe exactly what you are looking for? Returning information back to the python while on the server, or rendering an html file? There are different methods and it depends on what you want to do. You can use forms, url query strings, AJAX,…

On Wednesday, January 11, 2017 at 12:22:04 PM UTC-5, [email protected] wrote:
Hello everyone,

Can anyone provide a small example of how to ingest HTML in Python script while running on server?

Thanks,
Pratik


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/41c72e07-1c01-45c0-96e9-7f2b7ceacf75%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/704c1c7f-16b0-4e1d-9079-8cb2d09d7ee0%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/cc91bd67-75ce-41d4-86a6-78458d059968%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi,

The "code" argument should be *only* JavaScript code (compare to the examples on the page I linked) You are passing it HTML. I'm not sure what you are trying to accomplish with that, but I can state that it won't work.

Thanks,

Bryan

···

On Jan 13, 2017, at 11:48 AM, [email protected] wrote:

Hi Bryan,

Thank you for the response. Based on the first link, I tried to do something like below. What am I doing wrong here?

from bokeh.models import CustomJS

callback = CustomJS(args = dict(datepicker=datepicker), code="""
              <!doctype html>
              <html lang="en">
              <head>
                <meta charset="utf-8">
                <meta name="viewport" content="width=device-width, initial-scale=1">
                <title>jQuery UI Datepicker - Display month &amp; year menus</title>
                <link href="jquery-ui/jquery-ui.structure.min.css" rel="stylesheet" type="text/css"/>
                <link href="jquery-ui/jquery-ui.theme.min.css" rel="stylesheet" type="text/css"/>
                <script src="https://code.jquery.com/jquery-1.12.4.js&quot;&gt;&lt;/script&gt;
                <script src="jquery-ui/jquery-ui.min.js"></script>
                <script>
                \( function\(\) \{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;( "#datepicker" ).datepicker({
                  changeMonth: true,
                  changeYear: true
                });
                } );
                </script>
              </head>
              <body>
               
              <p>Date: <input type="text" id="datepicker"></p>
               
              </body>
              </html>

""")
datepicker = DatePicker(title="Date", callback = callback)

curdoc().add_root(datepicker)

I am unsure as to what will go in the args bracket? This is just the calendar widget.

On Friday, 13 January 2017 12:04:04 UTC-5, Bryan Van de ven wrote:
Hi,

The question does not make sense to me as stated (I'm not sure what "embed a widget which is a .js function" means in this context).

If you mean that you want to attach JS code to Bokeh widgets, this might be useful:

        http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html#userguide-interaction-callbacks

If you mean you want to take a third party JS library and extend Bokeh so it can be used in Bokeh documents, then perhaps this:

        http://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html

Thanks,

Bryan

> On Jan 12, 2017, at 8:47 PM, pratik...@gmail.com wrote:
>
> So, I am trying to learn to embed a widget which is a .js function. Trying to see how those external js functions can be used.
>
> Any examples that you could provide, Bryan?
>
> Thanks,
> Pratik
>
> On Thursday, 12 January 2017 17:09:44 UTC-5, Bryan Van de ven wrote:
> No, if you are trying to embed apps from a server you'd normally want autoload_server. That won't render a JS file tho. it will only provide a script tag for you to use. Server apps live in the server, and automatically reflect into the browser. There is no separate .js file involved that users would see or need. I'm not sure I'm clear on what you are trying to accomplish.
>
> Thanks,
>
> Bryan
>
>
> > On Jan 12, 2017, at 3:52 PM, pratik...@gmail.com wrote:
> >
> > Now, is this going to work with Bokeh server too?
> >
> > On Thursday, 12 January 2017 16:47:51 UTC-5, Bryan Van de ven wrote:
> > Perhaps you are looking for autoload_static:
> >
> > http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data
> >
> > Bryan
> >
> > > On Jan 12, 2017, at 3:31 PM, pratik...@gmail.com wrote:
> > >
> > > Hi,
> > >
> > > Sorry. Let me change my question and be more clear. I would like to render actually a .js file rather than html. Any examples or suggestions on that?
> > >
> > > Thanks,
> > > Pratik
> > >
> > > On Thursday, 12 January 2017 10:10:47 UTC-5, javbo wrote:
> > > Hi,
> > >
> > > Can you describe describe exactly what you are looking for? Returning information back to the python while on the server, or rendering an html file? There are different methods and it depends on what you want to do. You can use forms, url query strings, AJAX,..
> > >
> > > On Wednesday, January 11, 2017 at 12:22:04 PM UTC-5, pratik...@gmail.com wrote:
> > > Hello everyone,
> > >
> > > Can anyone provide a small example of how to ingest HTML in Python script while running on server?
> > >
> > > Thanks,
> > > Pratik
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> > > To post to this group, send email to bo...@continuum.io.
> > > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/41c72e07-1c01-45c0-96e9-7f2b7ceacf75%40continuum.io\.
> > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> > To post to this group, send email to bo...@continuum.io.
> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/704c1c7f-16b0-4e1d-9079-8cb2d09d7ee0%40continuum.io\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/cc91bd67-75ce-41d4-86a6-78458d059968%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/8ed367bb-de07-46d6-b59e-41a70e6a9245%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

Hi Bryan

To be clear I am trying to customize the datepicker widget. As you said I am now purely reading JS function. Can you explain what I should improve below:

from datetime import datetime

datepicker = DatePicker(title=“Date”, min_date=datetime(2015,11,1),

max_date=datetime.now(),

value=datetime(datetime.now().year,1,1)

)

callback = CustomJS(args=dict(datepicker=datepicker), code=open(“C:/Users/pg021/Desktop/predapp/pickadate.js/Gruntfile.js”).read())

#datepicker = DatePicker(title=“Date”, callback = callback)

curdoc().add_root(callback)

Thanks!

···

On Friday, 13 January 2017 14:45:33 UTC-5, Bryan Van de ven wrote:

Hi,

The “code” argument should be only JavaScript code (compare to the examples on the page I linked) You are passing it HTML. I’m not sure what you are trying to accomplish with that, but I can state that it won’t work.

Thanks,

Bryan

On Jan 13, 2017, at 11:48 AM, [email protected] wrote:

Hi Bryan,

Thank you for the response. Based on the first link, I tried to do something like below. What am I doing wrong here?

from bokeh.models import CustomJS

callback = CustomJS(args = dict(datepicker=datepicker), code=“”"

                                                    <!doctype html>
                                                    <html lang="en">
                                                    <head>
                                                      <meta charset="utf-8">
                                                      <meta name="viewport" content="width=device-width, initial-scale=1">
                                                      <title>jQuery UI Datepicker - Display month &amp; year menus</title>
                                                      <link href="jquery-ui/jquery-ui.structure.min.css" rel="stylesheet" type="text/css"/>
                                                      <link href="jquery-ui/jquery-ui.theme.min.css" rel="stylesheet" type="text/css"/>
                                                      <script src="[https://code.jquery.com/jquery-1.12.4.js](https://code.jquery.com/jquery-1.12.4.js)"></script>
                                                      <script src="jquery-ui/jquery-ui.min.js"></script>
                                                      <script>
                                                      $( function() {
                                                            $( "#datepicker" ).datepicker({
                                                              changeMonth: true,
                                                              changeYear: true
                                                            });
                                                      } );
                                                      </script>
                                                    </head>
                                                    <body>
                                                    <p>Date: <input type="text" id="datepicker"></p>
                                                    </body>
                                                    </html>

“”")

datepicker = DatePicker(title=“Date”, callback = callback)

curdoc().add_root(datepicker)

I am unsure as to what will go in the args bracket? This is just the calendar widget.

On Friday, 13 January 2017 12:04:04 UTC-5, Bryan Van de ven wrote:

Hi,

The question does not make sense to me as stated (I’m not sure what “embed a widget which is a .js function” means in this context).

If you mean that you want to attach JS code to Bokeh widgets, this might be useful:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html#userguide-interaction-callbacks](http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html#userguide-interaction-callbacks)

If you mean you want to take a third party JS library and extend Bokeh so it can be used in Bokeh documents, then perhaps this:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html](http://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html)

Thanks,

Bryan

On Jan 12, 2017, at 8:47 PM, [email protected] wrote:

So, I am trying to learn to embed a widget which is a .js function. Trying to see how those external js functions can be used.

Any examples that you could provide, Bryan?

Thanks,
Pratik

On Thursday, 12 January 2017 17:09:44 UTC-5, Bryan Van de ven wrote:
No, if you are trying to embed apps from a server you’d normally want autoload_server. That won’t render a JS file tho. it will only provide a script tag for you to use. Server apps live in the server, and automatically reflect into the browser. There is no separate .js file involved that users would see or need. I’m not sure I’m clear on what you are trying to accomplish.

Thanks,

Bryan

On Jan 12, 2017, at 3:52 PM, [email protected] wrote:

Now, is this going to work with Bokeh server too?

On Thursday, 12 January 2017 16:47:51 UTC-5, Bryan Van de ven wrote:
Perhaps you are looking for autoload_static:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data](http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data)

Bryan

On Jan 12, 2017, at 3:31 PM, [email protected] wrote:

Hi,

Sorry. Let me change my question and be more clear. I would like to render actually a .js file rather than html. Any examples or suggestions on that?

Thanks,
Pratik

On Thursday, 12 January 2017 10:10:47 UTC-5, javbo wrote:
Hi,

Can you describe describe exactly what you are looking for? Returning information back to the python while on the server, or rendering an html file? There are different methods and it depends on what you want to do. You can use forms, url query strings, AJAX,…

On Wednesday, January 11, 2017 at 12:22:04 PM UTC-5, [email protected] wrote:
Hello everyone,

Can anyone provide a small example of how to ingest HTML in Python script while running on server?

Thanks,
Pratik


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/41c72e07-1c01-45c0-96e9-7f2b7ceacf75%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/704c1c7f-16b0-4e1d-9079-8cb2d09d7ee0%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/cc91bd67-75ce-41d4-86a6-78458d059968%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/8ed367bb-de07-46d6-b59e-41a70e6a9245%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

Hi,

Are you just asking for style advice? Then that code looks fine. Are you saying it's not working somehow? Then you will need to share the contents of the .js file you are reading, and actually describe what it is, specifically, that you are trying to accomplish, a well as describe in detail, what incorrect or bad or unexpected result you are seeing.

Thanks,

Bryan

···

On Jan 14, 2017, at 2:24 PM, [email protected] wrote:

Hi Bryan

To be clear I am trying to customize the datepicker widget. As you said I am now purely reading JS function. Can you explain what I should improve below:

from datetime import datetime

datepicker = DatePicker(title="Date", min_date=datetime(2015,11,1),
                        max_date=datetime.now(),
                        value=datetime(datetime.now().year,1,1)
                        )

callback = CustomJS(args=dict(datepicker=datepicker), code=open("C:/Users/pg021/Desktop/predapp/pickadate.js/Gruntfile.js").read())

#datepicker = DatePicker(title="Date", callback = callback)

curdoc().add_root(callback)

Thanks!

On Friday, 13 January 2017 14:45:33 UTC-5, Bryan Van de ven wrote:
Hi,

The "code" argument should be *only* JavaScript code (compare to the examples on the page I linked) You are passing it HTML. I'm not sure what you are trying to accomplish with that, but I can state that it won't work.

Thanks,

Bryan

> On Jan 13, 2017, at 11:48 AM, pratik...@gmail.com wrote:
>
> Hi Bryan,
>
> Thank you for the response. Based on the first link, I tried to do something like below. What am I doing wrong here?
>
> from bokeh.models import CustomJS
>
> callback = CustomJS(args = dict(datepicker=datepicker), code="""
> <!doctype html>
> <html lang="en">
> <head>
> <meta charset="utf-8">
> <meta name="viewport" content="width=device-width, initial-scale=1">
> <title>jQuery UI Datepicker - Display month &amp; year menus</title>
> <link href="jquery-ui/jquery-ui.structure.min.css" rel="stylesheet" type="text/css"/>
> <link href="jquery-ui/jquery-ui.theme.min.css" rel="stylesheet" type="text/css"/>
> <script src="https://code.jquery.com/jquery-1.12.4.js&quot;&gt;&lt;/script&gt;
> <script src="jquery-ui/jquery-ui.min.js"></script>
> <script>
> \( function\(\) \{ &gt; ( "#datepicker" ).datepicker({
> changeMonth: true,
> changeYear: true
> });
> } );
> </script>
> </head>
> <body>
>
> <p>Date: <input type="text" id="datepicker"></p>
>
> </body>
> </html>
>
> """)
> datepicker = DatePicker(title="Date", callback = callback)
>
>
> curdoc().add_root(datepicker)
>
> I am unsure as to what will go in the args bracket? This is just the calendar widget.
>
> On Friday, 13 January 2017 12:04:04 UTC-5, Bryan Van de ven wrote:
> Hi,
>
> The question does not make sense to me as stated (I'm not sure what "embed a widget which is a .js function" means in this context).
>
> If you mean that you want to attach JS code to Bokeh widgets, this might be useful:
>
> http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html#userguide-interaction-callbacks
>
> If you mean you want to take a third party JS library and extend Bokeh so it can be used in Bokeh documents, then perhaps this:
>
> http://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html
>
> Thanks,
>
> Bryan
>
> > On Jan 12, 2017, at 8:47 PM, pratik...@gmail.com wrote:
> >
> > So, I am trying to learn to embed a widget which is a .js function. Trying to see how those external js functions can be used.
> >
> > Any examples that you could provide, Bryan?
> >
> > Thanks,
> > Pratik
> >
> > On Thursday, 12 January 2017 17:09:44 UTC-5, Bryan Van de ven wrote:
> > No, if you are trying to embed apps from a server you'd normally want autoload_server. That won't render a JS file tho. it will only provide a script tag for you to use. Server apps live in the server, and automatically reflect into the browser. There is no separate .js file involved that users would see or need. I'm not sure I'm clear on what you are trying to accomplish.
> >
> > Thanks,
> >
> > Bryan
> >
> >
> > > On Jan 12, 2017, at 3:52 PM, pratik...@gmail.com wrote:
> > >
> > > Now, is this going to work with Bokeh server too?
> > >
> > > On Thursday, 12 January 2017 16:47:51 UTC-5, Bryan Van de ven wrote:
> > > Perhaps you are looking for autoload_static:
> > >
> > > http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data
> > >
> > > Bryan
> > >
> > > > On Jan 12, 2017, at 3:31 PM, pratik...@gmail.com wrote:
> > > >
> > > > Hi,
> > > >
> > > > Sorry. Let me change my question and be more clear. I would like to render actually a .js file rather than html. Any examples or suggestions on that?
> > > >
> > > > Thanks,
> > > > Pratik
> > > >
> > > > On Thursday, 12 January 2017 10:10:47 UTC-5, javbo wrote:
> > > > Hi,
> > > >
> > > > Can you describe describe exactly what you are looking for? Returning information back to the python while on the server, or rendering an html file? There are different methods and it depends on what you want to do. You can use forms, url query strings, AJAX,..
> > > >
> > > > On Wednesday, January 11, 2017 at 12:22:04 PM UTC-5, pratik...@gmail.com wrote:
> > > > Hello everyone,
> > > >
> > > > Can anyone provide a small example of how to ingest HTML in Python script while running on server?
> > > >
> > > > Thanks,
> > > > Pratik
> > > >
> > > > --
> > > > You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> > > > To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> > > > To post to this group, send email to bo...@continuum.io.
> > > > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/41c72e07-1c01-45c0-96e9-7f2b7ceacf75%40continuum.io\.
> > > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> > >
> > >
> > > --
> > > You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> > > To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> > > To post to this group, send email to bo...@continuum.io.
> > > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/704c1c7f-16b0-4e1d-9079-8cb2d09d7ee0%40continuum.io\.
> > > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> > To post to this group, send email to bo...@continuum.io.
> > To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/cc91bd67-75ce-41d4-86a6-78458d059968%40continuum.io\.
> > For more options, visit https://groups.google.com/a/continuum.io/d/optout\.
>
>
> --
> You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.
> To post to this group, send email to bo...@continuum.io.
> To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/8ed367bb-de07-46d6-b59e-41a70e6a9245%40continuum.io\.
> For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9d2a1ef4-4d54-4491-9082-cd0a05b8c9d2%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

So I am trying to style the datepicker something like this:

The .js folder is directly available here to download, if it helps?

if this is not the best option do you have any other ideas to style the DatePicker?

Thanks,

Pratik

···

On Saturday, 14 January 2017 15:31:55 UTC-5, Bryan Van de ven wrote:

Hi,

Are you just asking for style advice? Then that code looks fine. Are you saying it’s not working somehow? Then you will need to share the contents of the .js file you are reading, and actually describe what it is, specifically, that you are trying to accomplish, a well as describe in detail, what incorrect or bad or unexpected result you are seeing.

Thanks,

Bryan

On Jan 14, 2017, at 2:24 PM, [email protected] wrote:

Hi Bryan

To be clear I am trying to customize the datepicker widget. As you said I am now purely reading JS function. Can you explain what I should improve below:

from datetime import datetime

datepicker = DatePicker(title=“Date”, min_date=datetime(2015,11,1),

                    max_date=datetime.now(),
                    value=datetime(datetime.now().year,1,1)
                    )

callback = CustomJS(args=dict(datepicker=datepicker), code=open(“C:/Users/pg021/Desktop/predapp/pickadate.js/Gruntfile.js”).read())

#datepicker = DatePicker(title=“Date”, callback = callback)

curdoc().add_root(callback)

Thanks!

On Friday, 13 January 2017 14:45:33 UTC-5, Bryan Van de ven wrote:

Hi,

The “code” argument should be only JavaScript code (compare to the examples on the page I linked) You are passing it HTML. I’m not sure what you are trying to accomplish with that, but I can state that it won’t work.

Thanks,

Bryan

On Jan 13, 2017, at 11:48 AM, [email protected] wrote:

Hi Bryan,

Thank you for the response. Based on the first link, I tried to do something like below. What am I doing wrong here?

from bokeh.models import CustomJS

callback = CustomJS(args = dict(datepicker=datepicker), code=“”"
<!doctype html>




jQuery UI Datepicker - Display month & year menus






                                                    <p>Date: <input type="text" id="datepicker"></p>
                                                    </body>
                                                    </html>

“”")
datepicker = DatePicker(title=“Date”, callback = callback)

curdoc().add_root(datepicker)

I am unsure as to what will go in the args bracket? This is just the calendar widget.

On Friday, 13 January 2017 12:04:04 UTC-5, Bryan Van de ven wrote:
Hi,

The question does not make sense to me as stated (I’m not sure what “embed a widget which is a .js function” means in this context).

If you mean that you want to attach JS code to Bokeh widgets, this might be useful:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html#userguide-interaction-callbacks](http://bokeh.pydata.org/en/latest/docs/user_guide/interaction/callbacks.html#userguide-interaction-callbacks)

If you mean you want to take a third party JS library and extend Bokeh so it can be used in Bokeh documents, then perhaps this:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html](http://bokeh.pydata.org/en/latest/docs/user_guide/extensions.html)

Thanks,

Bryan

On Jan 12, 2017, at 8:47 PM, [email protected] wrote:

So, I am trying to learn to embed a widget which is a .js function. Trying to see how those external js functions can be used.

Any examples that you could provide, Bryan?

Thanks,
Pratik

On Thursday, 12 January 2017 17:09:44 UTC-5, Bryan Van de ven wrote:
No, if you are trying to embed apps from a server you’d normally want autoload_server. That won’t render a JS file tho. it will only provide a script tag for you to use. Server apps live in the server, and automatically reflect into the browser. There is no separate .js file involved that users would see or need. I’m not sure I’m clear on what you are trying to accomplish.

Thanks,

Bryan

On Jan 12, 2017, at 3:52 PM, [email protected] wrote:

Now, is this going to work with Bokeh server too?

On Thursday, 12 January 2017 16:47:51 UTC-5, Bryan Van de ven wrote:
Perhaps you are looking for autoload_static:

    [http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data](http://bokeh.pydata.org/en/latest/docs/user_guide/embed.html#static-data)

Bryan

On Jan 12, 2017, at 3:31 PM, [email protected] wrote:

Hi,

Sorry. Let me change my question and be more clear. I would like to render actually a .js file rather than html. Any examples or suggestions on that?

Thanks,
Pratik

On Thursday, 12 January 2017 10:10:47 UTC-5, javbo wrote:
Hi,

Can you describe describe exactly what you are looking for? Returning information back to the python while on the server, or rendering an html file? There are different methods and it depends on what you want to do. You can use forms, url query strings, AJAX,…

On Wednesday, January 11, 2017 at 12:22:04 PM UTC-5, [email protected] wrote:
Hello everyone,

Can anyone provide a small example of how to ingest HTML in Python script while running on server?

Thanks,
Pratik


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/41c72e07-1c01-45c0-96e9-7f2b7ceacf75%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/704c1c7f-16b0-4e1d-9079-8cb2d09d7ee0%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/cc91bd67-75ce-41d4-86a6-78458d059968%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/8ed367bb-de07-46d6-b59e-41a70e6a9245%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.


You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To post to this group, send email to [email protected].

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9d2a1ef4-4d54-4491-9082-cd0a05b8c9d2%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.