-1

I'm trying to print out information into this window and not in the console. How do I do this?

from tkinter import *

print("Hello")
gui = Tk(className='StreetView Map')
# set window size
gui.geometry("500x200")

gui.mainloop()

I tried using the print function but nothing showed up in the window.

Michael M.
  • 10,486
  • 9
  • 18
  • 34
  • See https://stackoverflow.com/questions/30010703/send-the-output-of-print-to-tkinter-text-widget. – Hugh W Feb 19 '23 at 04:17
  • It seems like you're trying to ask two different questions (how to display text and how to show an iframe). Please create a separate post for each issue. – Michael M. Feb 19 '23 at 23:32

2 Answers2

1

You can create a Label.

Label(gui, text="Hello").pack()
Unmitigated
  • 76,500
  • 11
  • 62
  • 80
0

You need to Create a Text widget where you can insert the test on GUI on Tkinter.

Given your code it would have to be done like this.

from tkinter import *

gui = Tk(className='StreetView Map')

# set window size
gui.geometry("500x200")

T = Text(root, height = 5, width = 52)
T.pack()

#insert the string in Text Widget
T.insert(tk.END, "hello")

gui.mainloop()