Hi so I want to run a Python script (in this example it can be something as simple as print hello world) when a button on a Python Flask Server is pressed. In other words when I enter the web server, there will be a button and pressing it will launch the python script on my computer. Thank you
You can try the following code :
from flask import Flask
main_page = """
<!DOCTYPE html>
<html>
<body>
<h2>Button</h2>
<form action="button">
<button type="submit">Press Button!</button>
<form>
</body>
</html>
"""
app = Flask(__name__)
@app.route('/button'):
def button():
print("Hello World")
return main_page
@app.route('/')
def index():
return main_page
if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0')
Hi so I want to run a Python script (in this example it can be something...
Hi so I'm currently using MIT App Inventor to create a app and I wanted to know what would be the best way to link it with Python so that when I press a button in the app, a python script will run on my computer (ie something as simple as printing "hello world")
Hi I'm trying to write a code for a web server in python with flask. This is what I have so far from flask import Flask app = Flask(__name__) @app.route('/') #first endpoint i.e. "http://localhost/" def index(): return 'hello' #return data in string if __name__ == '__main__': app.run(debug=True) After running the code, I'm given a address to the web with the text hello. The problem is that this only works with my computer that is running the code. If I try...
Hi, I am current using flask to run a python web application that currently just allows users to access a video camera on a localhost. As of now, I need to type python main.py to actually run the project and turn on the localhost. What I want to do is, be able to click a button in HTML, through google chrome, and just run the webcam like that. To sum it up, I want to click a simple button and...
simple PYTHON 3 language. please comment each line I want to
understand. I know the picture says java but please complete code
in PYTHON. please use menu driven
[E] The "back" button used in a web browser is a great example of how stacks may be used. When a user visits a new web page, the current page gets pushed onto the stack. When the user clicks the back button, the last page pushed onto the stack is popped off...
Hi I need some help writing a security code using python mongodb restful api. I just need help on how to provide a security login to user to enter their username and password or to have a block in using extra access once they have logined and they want more access to the databases they will be force to sign out of the server but I just do not know how to start on it can someone show me how...
HI there I tried to run this code as an example given by my teacher, but when I copied and tried to run, then it ask to create BagInterface and ArrayBag class. Do i have to do something more previously in order to run this code. Can anyone help me her please? import java.util.Arrays; public class BagTraceExample { public static void main(String[] args) { BagInterface<String> animalBag = new ArrayBag(); System.out.println(animalBag.isEmpty());...
I need help with my javascript project, I've started on it but I can't seem to get ym java scripts to work with my index.html. Can someone please help me fix my code? I need the main.js & scratchpad.js to work with my index.html .Thank you Directions: Go to the following link: https://developer.mozilla.org/en-US/docs/Learn/Getting_started_with_the_web/JavaScript_basics On that page, scroll down to "A 'hello world' example". Follow the step-by-step instructions to download their code and edit it in your text editor of choice....
Experiment with the terminal and C programming I want you to be able to setup a folder, change to a folder, create a new file with the editor (windows version is fine), rename files, delete files, and change permissions. How to create a compiled program Create your source code; lets say it is named test.c Compile it using: gcc test.c –o test Change the permissions to execute for everyone (755) Run it by: ./test Create two programs The first one...
Hi, I need some help finishing the last part of this Python 1 code. The last few functions are incomplete. Thank you. The instructions were: The program has three functions in it. I’ve written all of break_into_list_of_words()--DO NOT CHANGE THIS ONE. All it does is break the very long poem into a list of individual words. Some of what it's doing will not make much sense to you until we get to the strings chapter, and that's fine--that's part of...
Java Help Please: I'm doing something wrong with my while loop. I want my code to check the phone number that is input to make sure it matches. If it doesn't I want it to print out Error! and I want my While loop to ask the user to try again by inputting another phone number. When the user puts in a phone number that matches I want the program to continue to output my tokens. When I run this...