0

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)
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by bumsfeld
0

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()
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.