0

Iv'e been trying to develop a wrapper GUI for a exe/cmd file, i cant seem to figure out how to read from this file and put the contents into a label in Tkinter and how to write directly to the exe/cmd file through an entry using tkinter. The file also has to be running in the background, something i dont know how to do at all. Iv'e tried to reverse engineer the software but there has to be an easier way. The reason i'm addressing the file as a exe/cmd file is because it is an application file which opens a "custom console" (that's the best i can describe it) the console is run using c++. So if anyone could teach me how to communicate with this file i would really appreciate it.

My Tkinter Interface, I don't have any code in place to read the exe/cmd file because i do not know how to. I have also attached an image to try and visualize what im trying to achieve.

import tkinter as tk
import os

HEIGHT = 1080
WIDTH = 1920
FRAMECOLOR = '#80c1ff'
root = tk.Tk()

canvas = tk.Canvas(root, height=HEIGHT, width=WIDTH)
canvas.pack()

frame = tk.Frame(root, bg=FRAMECOLOR, bd=5)
frame.place(relx=0.35, rely=0.8, relwidth=0.5, relheight=0.1, anchor='n')

lower_frame = tk.Frame(root, bg=FRAMECOLOR, bd=10)
lower_frame.place(relx=0.35, rely=0.1, relwidth=0.5, relheight=0.67, anchor='n')

button_frame = tk.Frame(root, bg=FRAMECOLOR, bd=10)
button_frame.place(relx=0.75, rely=0.1, relwidth = 0.25, relheight=0.8, anchor='n')

entry = tk.Entry(frame, font=40)
entry.place(relwidth=1, relheight=1)

button1 = tk.Button(button_frame, text="Test Button", font=40)
button1.place(relx=0.001, rely=0, relwidth=0.5, relheight=0.1)

label = tk.Label(lower_frame)
label.place(relwidth=1, relheight=1)

root.mainloop()

enter image description here

Thanks - Connor

baldr
  • 2,891
  • 11
  • 43
  • 61
  • If your "exe" is a command line program, you can use `subprocess.Popen` to call the program, passing any arguments to it and you can also redirect the text output of that program to your python code. – scotty3785 Oct 01 '20 at 10:52
  • Does this answer your question? [Redirect command line results to a tkinter GUI](https://stackoverflow.com/questions/665566/redirect-command-line-results-to-a-tkinter-gui) – scotty3785 Oct 01 '20 at 10:53
  • @scotty3785 Thanks for linking me the forum post but im still lost. I read through the answers and found that the answer that suits me best is the post by jfs. The exe/cmd file is a server (meaning yes it is a command line) but i need to get a constant update. I tried using jfs's answer but i could figure out how it worked. I saw that he create functions but im not sure how i am supposed to link those to my tkinter interface. Thanks for your patients - Connor – Connor-Gold Oct 02 '20 at 00:11

0 Answers0