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 - i'm not sure how to use numpy zeros
- how to use python reshape
- python - i don't know how to use ipv6 udp jumbogram
- python - how to use django form
- how to use for in python
- python - i want to use faster rcnn
- python - [tkinter] i want to set the initial value of paned window
- c# - how to use unity initialization code
- c++ - how to use hash
- how to use fscanf and what to put in () of rewind()?
- python - how can i make the tic-tac-toe that i made easier?
- python 3x - how to update tkinter option menu in python
- python - tkinter tends to be heavy
- python - how to determine the url
- how to use th:each in thymeleaf
- about python flask
- python - tkinter key input standby method
- python - tkinter display image cannot be saved
- python - how to display how many words you have in the read file
- python - i want to reproduce the current mechanism by replacing the check box part with a button that switches the display
- python - i want to improve the page display function of my gui
- i want to change the image drawn in rgb using python matplotlib to hsv
- python - i want to dynamically change the label on the tkinter gui by processing the for loop
- i want to fire an event on a button using python tkinter
- python - every time you enter tkinter entry, get the entered string
- python - image data sent from flask to rails is strange (becomes strange characters)
- [tkinter] when the image canvas display is divided into different functions, it cannot be displayed [python]
- [tkiinter] display error on top left icon of messagebox? [python]
- python i want to use a function within a function