May-25-2018, 03:52 PM
Hello to all.
I created a frame and two buttons, I assigned two functions to the buttons, one closes the window, the other displays the / etc / fstab file in the shell.
I would like to be able to view the output of the second function within the frame.
I created a frame and two buttons, I assigned two functions to the buttons, one closes the window, the other displays the / etc / fstab file in the shell.
I would like to be able to view the output of the second function within the frame.
from tkinter import * import os #window mywin=Tk() #function about to close window def close_window (root): root.destroy() #function about to read fstab def fstab(): os.system("cat /etc/fstab") #size window mywin.geometry("600x400+600+100") mywin.title('WINDOW') #text in window mytext=Label(text='View', fg='white', bg='black', font=('Helvetica',30)).pack() #button GO! gobutton=Button(text='GO!', command = fstab).pack() #frame for my output myframe=Frame(width=300, height=300).pack() #button Exit exitbutton=Button (mywin, text="Exit", command = lambda: close_window(mywin)).pack() #go mainloop mywin.mainloop()