Skip to content
Advertisement

NameError: global name ‘END’ is not defined

I have found this code about scrollbar is just working fine.

JavaScript

I try to use it in my code like this:

JavaScript

But when I ran above code, I got an error on insertion line.

JavaScript

By the way, I tried to find documentation and a link from effbot is the closest I got but still couldn’t understand what is wrong.

Advertisement

Answer

END, LEFT, and BOTH all reside in the tkinter namespace. Thus, they need to be qualified by placing tk. before them:

JavaScript

Or, you could import them explicitly if you want:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement