I'm trying to make a text box appear in a window using Tkinter, but it won't work... I've tried lots of things but nothing's working.
(No, I'm not going to look at this question which basically duplicates my situation. I already did, and it didn't help me at all.)
This is my current code:
# tkinter
from tkinter import *
# class
class App(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
box = Text(width=90, height=50)
self.pack()
# create the window
window = App()
# attributes
window.master.title("Text box")
window.master.minsize(800, 600)
window.master.maxsize(800, 600)
# start program
window.mainloop()
Thanks.
You have to pack
the box as well:
class App(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
box = Text(width=90, height=50)
box.pack() #instead of self.pack()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.