Is there a way to read the contents of a exe file and write it into a label in Tkinter Python?

非 Y 不嫁゛ 提交于 2021-01-29 14:29:33

问题


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()

Thanks - Connor

来源:https://stackoverflow.com/questions/64151718/is-there-a-way-to-read-the-contents-of-a-exe-file-and-write-it-into-a-label-in-t

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!