python textbox 1

python textbox

from Tkinter import *

root = Tk()
T = Text(root, height=2, width=30)
quote = """HAMLET: To be, or not to be--that is the question:
Whether 'tis nobler in the mind to suffer
The slings and arrows of outrageous fortune
Or to take arms against a sea of troubles
And by opposing end them. To die, to sleep--
No more--and by a sleep to say we end
The heartache, and the thousand natural shocks
That flesh is heir to. 'Tis a consummation
Devoutly to be wished."""
T.insert(END, quote)

Here is what the above code is Doing:
1. We import the Tkinter module.
2. We create a Tkinter variable called root.
3. We create a Tkinter variable called T.
4. We create a variable called quote.
5. We insert the quote variable into the T variable.
6. We run the mainloop() function.

Similar Posts