Specifically, the Tkinter code:
from Tkinter import * from ScrolledText import * root = Tk () t = ScrolledText () t.pack () root.mainloop ()
and Flask code:
from flask import Flask, request app = Flask (__ name__) @ app.route ("/") def index (): return app.send_static_file ("index.html") @ app.route ("/hoge" ;, methods = ["GET"]) def hoge (): hoge = request.args ["hoge"] return hoge app.run (debug = True)
I want to write the hoge I got with Flask to Tkinter's ScrolledText.
I examined multithreading and subprocesses, but I didn't understand.
Answer # 1
In short, you want to exchange information between the client application and the web application.
There are various ways to pass information between processes.
Generally, I think that I use a database, but if the above two applications are running on the same terminal and writing is always only on the Web application side, it can also be a file.
There are other things such as shared memory delivery, message pipes, and message queues.
If you need to update the screen at the event (timing) received by request in Flask, there are two possible ways.
(1) The content of the database and file is rewritten on the Flask side, and the Tkinter application side goes to retrieve the information at regular intervals. Update the screen if it has been updated.
(2) The Flask side sends an event to the Tkinter app at the timing of receiving the request, and at that timing, the Tkinter app updates the content with the received information.
I think that the classic and simple one is ①, but if that doesn't work, I think it's easy to implement interprocess communication using multiprocessing.
Interprocess communication with multiprocessing module
End of reference.
- (python) how to use randomrandint
- python 3x - how to use scipyintegrate
- How to use zip function in Python
- how to use boolean type in python
- How to use if and if-else in python
- How to use SQLite in Python
- How to use and and or in Python
- How to use python thread pool
- python 3x - please tell me how to use qtimer
- python 3x - how to use matplotlibpyplot
- how to use  in python
- python - how to use while statement
- python - how to use slug in django
- python - how to use try and continue
- python 3x - i don't know how to use python for statement
- Python flask framework realizes browser click custom jump page
- ruby - how to use stdingets and radix
- Python Flask framework implements simple addition tool process analysis
- Python flask framework how to display images to web pages
- python - [currently under verification] will problems occur if both bottle and flask are installed?
- python - crash when using tkinter from anaconda on macos 10146 mojave
- python - tkinter radio button question
- python - i want to know how to eliminate no module named'flask'
- [python] [tkinter] i want to create a gui that displays the person's name by performing face recognition
- python - i would like to know the meaning of bound method miscmainloop of
- python - pyhton(tkinter) i would like to know the height of the scrolled text, but could it not be obtained? ? (i want to derive
- python(tkinter) dialog design is not what you want i want to grid a widget under the condition that the column widths are unifie
- i want to display a gif animation with python(tkinter) operation, but it is currently displayed as a stop image