libraries question

58 views
Skip to first unread message

kb...@hw.ac.uk

unread,
Nov 11, 2015, 2:42:19 PM11/11/15
to brython
Hi, does brython allow you make use of the useful python libraries such as matplotlib, sic-kit learn, pygame etc? If not could I run them on the server and use brython like a user interface for the browser? thanks

Kiko

unread,
Nov 11, 2015, 2:53:01 PM11/11/15
to bry...@googlegroups.com
2015-11-11 20:42 GMT+01:00 <kb...@hw.ac.uk>:
Hi, does brython allow you make use of the useful python libraries such as matplotlib, sic-kit learn, pygame etc? If not could I run them on the server and use brython like a user interface for the browser? thanks

Short answer: NO, these libs doesn't work on the client side.

A more detailed answer: As a rule of thumb, it happens something similar to what happens to Pypy, libs with C/C++/Fortran/compiled code doesn't work out of the box and you should rewrite parts of these libs to make it work. If the lib is written in pure python it could work with Brython.

If you want to use Python on the server you can use Brython (client) to communicate with it. I'm doing a brython(client)+flask(server) app and it works pretty well.

 

--
You received this message because you are subscribed to the Google Groups "brython" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brython+u...@googlegroups.com.
To post to this group, send email to bry...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/brython/9cda5fea-b6d8-4974-90ae-e886890b3f9c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

kb...@hw.ac.uk

unread,
Nov 11, 2015, 3:27:27 PM11/11/15
to brython
Thanks for your reply, much appreciated! I'm new to programming and my background is in another engineering discipline. Am I correct in thinking that if you need to use any of the libraries I mentioned above then you run a python program on the sever with those libraries and communicate with the client running Brython? If so, is there any noticeable lag during use? Could I for example make a game where the engine and logic is written in python on the server (using some of the handy libraries) and use brython on the client for the graphics? 

Christophe Bal

unread,
Nov 11, 2015, 6:10:05 PM11/11/15
to bry...@googlegroups.com

Hello.

Can you give a basic example of communication between Flask and brython ? This could be useful for all thé comunity.

Olemis Lang

unread,
Nov 12, 2015, 9:25:49 AM11/12/15
to bry...@googlegroups.com
On 11/11/15, kb...@hw.ac.uk <kb...@hw.ac.uk> wrote:
>
[...]
>
> Could I for example make a game where the engine and logic is written in
> python on the server (using some of the handy libraries) and use brython on
> the client for the graphics?

sure !

[...]

--
Regards,

Olemis - @olemislc

Apache™ Bloodhound contributor
http://issues.apache.org/bloodhound
http://blood-hound.net

Brython committer
http://brython.info
http://github.com/brython-dev/brython

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:

Kiko

unread,
Nov 12, 2015, 9:50:15 AM11/12/15
to bry...@googlegroups.com
2015-11-12 0:10 GMT+01:00 Christophe Bal <proj...@gmail.com>:

Hello.

Can you give a basic example of communication between Flask and brython ? This could be useful for all thé comunity.


In flask, for instance, you can get info from a hidden form and pass it to the url (view), you could use ajax,.. I think the usage is similar to what you would do between flask/django/RoR/.../server and js/Brython/client
 

Christophe Bal

unread,
Nov 12, 2015, 10:01:14 AM11/12/15
to bry...@googlegroups.com

Thanks Kiko.

Have you try a ReST structure ?

Kiko

unread,
Nov 12, 2015, 10:04:46 AM11/12/15
to bry...@googlegroups.com
2015-11-12 16:01 GMT+01:00 Christophe Bal <proj...@gmail.com>:

Thanks Kiko.

Have you try a ReST structure ?

Not yet.

I'm experimenting with flask and it is far from my field (science).

 

Kiko

unread,
Nov 17, 2015, 4:39:19 AM11/17/15
to bry...@googlegroups.com
2015-11-12 16:04 GMT+01:00 Kiko <kikoco...@gmail.com>:


2015-11-12 16:01 GMT+01:00 Christophe Bal <proj...@gmail.com>:

Thanks Kiko.

Have you try a ReST structure ?

Not yet.

I'm experimenting with flask and it is far from my field (science).

You can use the app also providing lan and lot coordinates in the url, e.g.:
http://map2wiki.runbear.webfactional.com/index?lon=-3.68482&lat=40.43294&zoom=18

It is not REST elegant but it is a simple example of an API... :-P

Christophe Bal

unread,
Nov 18, 2015, 3:14:31 AM11/18/15
to bry...@googlegroups.com
Thanks a lot for the links.


Christophe BAL
Enseignant de mathématiques en Lycée et développeur Python amateur
---
French math teacher in a "Lycée" and Python amateur developer

Reply all
Reply to author
Forward
0 new messages