Hello everyone!

I am tring to use Tkinter from terminal (I'm on a mac) and I keep raising AttributeErrors on both Python 2.7 and Python 3. For 2.7 I input:

from Tkinter import *
win = Tk()
f = Frame(win)
b1 = Button(f, "One")

and I raise the AttributeError: 'str' object has no attribute 'keys'

And for Python3 I try:

from tkinter import *
win = Tk()
f = Frame(win)
b1 = Button(f, "One")

and I raise the AttributeError: 'str' object has no attribute 'items'.

Any thoughts on it? I've searched around but found nothing so far, still searching however as I type this. ^.^

Recommended Answers

All 2 Replies

Take a look at the first code example Click Here especially how text is assigned so it appears on the button.

Sweet, thanks for that link!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.