hi i got a a Tkinter text widget and a string i want to know how to display the string in the text widget ??

abc = "hello world" 

text = Text(app, width=80,height=40, wrap='none').grid(row=2, column=2)

Recommended Answers

All 2 Replies

Here is example ...

# one look at the Tkinter Text widget
# use ctrl+c to copy, ctrl+x to cut selected text, 
# ctrl+v to paste, and ctrl+/ to select all
# text area can be scrolled with mouse wheel

import Tkinter as tk

root = tk.Tk()

# create the text widget
# width=width in chars, height=lines of text
text = tk.Text(root, width=50, height=5, wrap='none', bg='yellow')
text.pack()

abc = "hello world" 

# show result in text widget
text.insert('insert', abc)

# start cursor in the text widget
text.focus()

root.mainloop()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.