Reputation: 25
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.
Upvotes: 0
Views: 72
Reputation: 32189
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()
Upvotes: 1