vedantkandoi
Posts: 2
Joined: Wed Sep 12, 2018 10:41 am

Input from PC

Thu Sep 20, 2018 8:50 am

Found a lot of ways for remote desktop but what I want is a bit different. My pi and my pc are connected through LAN. What I want is to go to an address in my browser which asks for input to a python script. Using that input I want to do further calculations and display it on the browser itself. Is something like this feasible? Preferably, this should work with pi and an android phone too.

User avatar
B.Goode
Posts: 10356
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Input from PC

Thu Sep 20, 2018 9:15 am

There are many ways to achieve what you are seeking.

You could use a web framework like Flask or Bottle. There is Raspberry Pi Foundation documentation here: https://projects.raspberrypi.org/en/pro ... with-flask

Or look at RemiGui - http://www.remigui.com

User avatar
topguy
Posts: 6527
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Input from PC

Thu Sep 20, 2018 9:16 am

Your description is a bit confusing, but if everything happens in the browser I dont see the link to "remote desktop".
A web-browser needs a web-server, and there is simple ways to add a web-server to a pyton script. Link below.

https://projects.raspberrypi.org/en/pro ... with-flask

Heater
Posts: 16092
Joined: Tue Jul 17, 2012 3:02 pm

Re: Input from PC

Thu Sep 20, 2018 11:17 am

Yes it's perfectly feasible.

I once made a terminal emulator in the browser. Text typed into the emulator window was sent to the server over web sockets. The server was written in node.js and sent the typed text to a Bash shell it had started. Output from the Bash shell session was then returned to the browser via the web socket connection, for display in the terminal emulation.

This kind of technique could be used to talk to your Python program directly instead of a Bash shell.

Don't forget to secure it all with HTTPS, passwords etc.
Memory in C++ is a leaky abstraction .

Return to “Python”