halny
halny

Reputation: 63

Python Tkinter Tclerror, circle.config()

This is exercise 19.3 from Think Python of Allen Downey. The code is suppose to get the color of the entry widget and change the background color of the circle. I have no idea why after clicking the button the code returns an error Tclerror: unknown option "-fill". It is strange as the book itself provide exactly the same solution. Is something wrong with the configuration of my Python? No idea. Please help.

from swampy.Gui import *

g = Gui()
g.title = ('Gui')

canvas = g.ca(width=500, height=500)
canvas.config(bg='white')
circle = None

def make_circle():
    global circle
    circle = canvas.circle([0,0], 100, fill='red')

def change_color():
    if circle == None:
        return
    my_color = entry.get()
    my_circle.config(fill=my_color)


my_circle = g.bu(text='Make circle', command = make_circle)
entry = g.en(text='Any text', bg = 'blue')
g.bu(text='Change color', command = change_color)

g.mainloop()

Upvotes: 0

Views: 106

Answers (0)

Related Questions