On 21/01/2021 12:39, Terry Coles wrote:
Hi,
I'm building a Web page to allow users to monitor key status information on
one of the Pis at WMT. I also want to create a page where users can press a
button to carry out certain tasks, such as Start or Stop some music playing or
select a new Playlist. The Player is written in Python. Altogether, there are
around 10 or more control functions that I want to invoke.
I have the monitoring page working reasonably well using a suitable html
template and a Flask route which populates the status values on the rendered
page. However, the control side is making me think a bit. I've found quite a
lot of tutorials and text book examples that use forms and a 'Submit' button,
but so far nothing quite like what I want.
What I need is for the user to be presented with set of buttons that, when
pressed, cause a bit of Python code to be executed that communicates with the
Player program. On receipt of the message, the Player program will trigger a
set of functions to carry out the requested action. The communication side is
sorted; all I need is an example or a link to a suitable tutorial that
illustrates the Flask code that I need to make it happen and if necessary, the
associated template.
Here is a bit of a demonstration:
https://www.youtube.com/watch?v=jsj-cnHkr_k
Peter
--
Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
Check to whom you are replying
Meetings, mailing list, IRC, ... http://dorset.lug.org.uk
New thread, don't hijack: mailto:dorset@mailman.lug.org.uk