0

I want to make a menu with a message box (or self filling text box) and some buttons.

This message box must contain the printed output from another py program.

Here is my code on Dropbox.

The printed output is in this code: Wunderground_info

Who could help me with this problem?

nbro
  • 15,395
  • 32
  • 113
  • 196
  • 1
    You should just add the code to your question. And when you say menu, do you mean a top bar menu? Or is the menu a part of your actual window? If your display text, use a label, and you Tkinter's `StringVar()` to store it. – Zizouz212 Mar 22 '15 at 16:22
  • 1
    What is your specific question? What part of the problem do you need help with. – Bryan Oakley Mar 22 '15 at 17:04
  • 1
    I'm voting to close this question as off-topic because you really should add both code and output to the question --- it will not only make this question easier to answer, but also will provide lasting value --- as other people with similar problems will be able to find it easier. – jb. Mar 22 '15 at 19:22

1 Answers1

3

If you really need to get the output from stdout, then you probably need to temporarily redirect it. See: Can I redirect the stdout in python into some sort of string buffer? Then, once you have that output in a string , it should be straightforward to create a frame with it:

from ScrolledText import ScrolledText
import Tkinter as tk

class OutputViewer(tk.Frame):
    def __init__(self, data, master=None):
        tk.Frame.__init__(self, master)
        self.text = ScrolledText(self, width=90, height=13)
        self.text.pack()
        self.text.insert(tk.END, data)
        self.text.see(tk.END)

Hope that helps.

Community
  • 1
  • 1
Ellis Michael
  • 962
  • 1
  • 8
  • 14