10

Is there an alternative to making educational Java applets for physics simulations like projectile motion, gravity, etc?

Eli Gassert
  • 9,745
  • 3
  • 30
  • 39
hershey92
  • 783
  • 2
  • 6
  • 17

6 Answers6

8

If you want it to run in a browser, you could use PyJamas - which is a Python-to-Javascript compiler and set of tools.

I'm not sure how well it is maintained these days, though.

Eli Bendersky
  • 263,248
  • 89
  • 350
  • 412
7

In this day and age, you might look to the HTML 5 canvas & JS.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
5

While I'm all for the "HTML5 & JS", you can consider Jython and simply write a Java Applet in Python (2.2.3, but...) Java is not only a language, so you're free to choose.

alf
  • 8,377
  • 24
  • 45
2

Brython is your alternative. It allows you to define "text/python" scripts.

jgomo3
  • 1,153
  • 1
  • 13
  • 26
2

You can run IronPython in Silverlight applications:

http://www.voidspace.org.uk/ironpython/silverlight/index.shtml

Gareth Davis
  • 27,701
  • 12
  • 73
  • 106
  • so from all the comments. Can I use pygame to create a physics simulation, then use PySide to add GUI elements and finally IronPython to put it on the web ??? – hershey92 Jan 09 '12 at 15:04
  • yep, that in theory should be fine. One restriction I think you might bump into is that silver light won't allow you to run native CPython extensions. – Gareth Davis Jan 09 '12 at 16:14
  • hey, could you please expand on 'native Cpython' and also present a solution for this problem. This is my first encounter to a python project, thanks a ton. – hershey92 Jan 09 '12 at 20:12
  • 2
    I've just looked at the source for pygame and it contains an awful lot of C code. This isn't unusual in python extensions, but compiling it and convincing Silverlight to load the binary will present a serious issue and may not even be possible. – Gareth Davis Jan 09 '12 at 20:59
1

You can run CPython in the browser using empythoned. There is no proper interface from Python to the browser though, so it will be hard to do any GUI applications.

Janus Troelsen
  • 20,267
  • 14
  • 135
  • 196