Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial

Henry Bell
40 PointsI can't seem to get it to work
I have followed your code exactly but when I run it all that pops up is a white box without the banner or anything else.

Henry Bell
40 Pointsimport tkinter
class Memory:
def __init__(self, master):
self.master = master
self.mainframe = tkinter.Frame(self.master, bg='white')
self.mainframe.pack(fill = tkinter.BOTH, expand=True)
self.build_grid()
self.build_banner()
def build_grid(self):
self.mainframe.columnconfigure(0, weight=1)
self.mainframe.rowconfigure(0, weight= 0)
self.mainframe.rowconfigure(1, weight= 0)
self.mainframe.rowconfigure(2, weight = 0)
def build_banner(self):
banner = tkinter.label(
self.mainframe,
background='red',
text = 'Memory',
fg='white',
font=('Helvetica', 24)
)
banner.grid(
row=0, column=0,
sticky='ew',
padx=10, pady=10
)
if __name__ == '__main__':
root = tkinter.Tk()
Memory(root)
root.mainloop()
[MOD: added ```python formatting -cf]
1 Answer

Chris Freeman
Treehouse Moderator 68,460 PointsWhen I run your code locally, I see:
$ python tkinter1.py
Traceback (most recent call last):
File "tkinter1.py", line 36, in <module>
Memory(root)
File "tkinter1.py", line 10, in __init__
self.build_banner()
File "tkinter1.py", line 21, in build_banner
banner = tkinter.label(
AttributeError: 'module' object has no attribute 'label'
Looking at line 21:
banner = tkinter.label( #<-- Label should be capitalized
After this fix. it worked!
Chris Freeman
Treehouse Moderator 68,460 PointsChris Freeman
Treehouse Moderator 68,460 PointsCan you post your code?