Printing The Output Of A Script To A Window In Python
I am trying to create a GUI for the analyzeMFT python program. So far this is what i have #!/usr/bin/python # -*- coding: utf-8 -*- from Tkinter import * from ttk import * impo
Solution 1:
Instead of using print like you would normally use to display results to the console you can use insert()
on your text box.
EDIT:
First change:
area = Text(self)
area.grid(row=2, column=1, columnspan=2, rowspan=4,
padx=5, sticky=E+W+S+N)
To:
self.area = Text(self)
self.area.grid(row=2, column=1, columnspan=2, rowspan=4,
padx=5, sticky=E+W+S+N)
This way your text box is set up as a class attribute that we can use.
Then use:
self.area.delete(1.0, "end") # to clear text box
self.area.insert("end", your_output variable or string) # to insert content
Post a Comment for "Printing The Output Of A Script To A Window In Python"