I have a simple graphics program that shows some instructions and touch buttons to a touch screen in a remote raspberry.
Instead of executing directly, I run it through a SSH connection, so I have in my desktop al application log.
I would like to have some short of interaction from the console I run the script, like execute some functions or change values of some variables.
Is that even possible?
I do not want to create a console inside the TKinter window, as alessandro asked: How to embed a terminal in a Tkinter application?
not sure if I should use a short of subprocess, as user1941008, but htis seemes too complicate Write to terminal in Tkinter GUI
and I do prefer not to create a client/server setup or a middle buffer for this thing, too complex, and i will have to rewrite things to send the logs to new program.
I add a little little version of my code:
#!/usr/bin/env python3
import tkinter as tk
class _tkapp(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.master = master
self.pack()
self.create_widgets()
def create_widgets(self):
self.redButton = tk.Button(self, text='Make me red', command=self.paintMeRed)
self.redButton.pack(side='top')
self.blueButton = tk.Button(self, text='Make me blue', command=self.paintMeBlue)
self.blueButton.pack(side='top')
self.quit = tk.Button(self, text='QUIT', fg='red', command=self.master.destroy)
self.quit.pack(side='bottom')
def paintMeRed(self):
tk_root.configure(background='red')
print('user click on RED')
def paintMeBlue(self):
tk_root.configure(background='blue')
print('user click on BLUE')
tk_root = tk.Tk()
tk_root.geometry("200x120")
tk_app = _tkapp(master=tk_root)
tk_app.mainloop()
this allow me to see on console what user cliked, my objetive, change the color also from console