Exporting Programs in Glowscript 1.1 Vpython with sliders

152 views
Skip to first unread message

Scott Pflaumer

unread,
Jun 4, 2015, 4:38:18 PM6/4/15
to glowscri...@googlegroups.com
I've been exporting some of my glowscript programs (or some which others wrote, but with a creative commons licence) to a wikispaces page so my students can use these sims easier. In general, it works great, however I've noticed that in two of my programs with sliders, the sliders don't show up in the export, even though they do work here. Any idea what might be going on? 

Here is an example: (not working)  


Same program here: (working)


Thanks,
-Scott


Bruce Sherwood

unread,
Jun 4, 2015, 5:27:45 PM6/4/15
to glowscri...@googlegroups.com
Windows 7, Chrome and Firefox: I don't see a slider in either version. In what environment is the slider visible?

Scott Pflaumer

unread,
Jun 4, 2015, 5:47:39 PM6/4/15
to glowscri...@googlegroups.com
It seemed to work in windows 8 Chrome. However sometimes I would change something like my initial velocity and then it would go away. I'm not sure how those two things are connected. There is also something else that is strange, I imported your Frank Hertz simulation (with slider) into my Wiki page just to see if the slider would work there, since it obviously does work on your page. Unfortunately the slider disappeared again. 


If necessary, I can just give my students a link to my Glowscript page to let them start from there and avoid this problem. 

Thanks,
-Scott

Bruce Sherwood

unread,
Jun 4, 2015, 6:29:46 PM6/4/15
to glowscri...@googlegroups.com
I can't reproduce the slider being missing in an exported Franck-Hertz program.

My best guess is that you've got another reference to jquery on your web page. Here is what GlowScript says when you click "Share or export this program":

Export: you can embed the program directly in your own web page, using the following HTML. If your page already uses jquery, you should delete that <script> tag.

Scott Pflaumer

unread,
Jun 4, 2015, 8:34:37 PM6/4/15
to glowscri...@googlegroups.com
It does look like Wikispaces uses jquery. I've never used HTML before though. Does <script> mean the same thing as </script>? I do not see any <script> by itself. While there are five </script> near the top and one near the bottom when I remove them it either gives me errors or does not run. I tried getting rid of all of them and just the last one, but no luck. 

I really appreciate your help!
-Scott

Bruce Sherwood

unread,
Jun 4, 2015, 9:57:31 PM6/4/15
to glowscri...@googlegroups.com
In an html file a JavaScript program is delimited thus:

<script>....program....</script>

You might try the experiment of deleting the first or possibly both of these two lines in the GlowScript export:

<script type="text/javascript" src="http://www.glowscript.org/lib/jquery/1.1/jquery.min.js"></script>
<script type="text/javascript" src="http://www.glowscript.org/lib/jquery/1.1/jquery-ui.custom.min.js"></script>

The problem does seem to be conflicting versions of the jquery library (which is where the slider comes from). If you had full control of your environment the thing to do is to delete other invocations of jquery, but maybe if you delete the GlowScript choice of jquery version it can work with the one that's already there.

But do you have any diagnosis of why I don't even see a slider in your supposedly working glowscript.org version?

Scott Pflaumer

unread,
Jun 6, 2015, 11:55:11 AM6/6/15
to glowscri...@googlegroups.com
Thank you very much! Getting rid of the first line made it work. For whatever reason it seems like my program is unreliable when I set the acceleration/slider value to 0. Sometimes it would run ok, but then other times, even when I made no changes to the code the slider would not appear. I wasn't aware that a program could run two different ways with the exact same code, but that is what appeared to be is happen. As long as I keep the acceleration non-zero it seems to work (at least for my computer):


-Scott
Reply all
Reply to author
Forward
0 new messages