On Thu, Mar 21, 2013 at 7:43 PM, maiden129 <sengokubasarafe...@gmail.com> wrote:
> Hello,
>
> I'm using the version 3.2.3 of Python and I am having an issue in my program 
> and I don't know how to fix it:
>
> counterLabel["text"] = str(counter)
> NameError: global name 'counterLabel' is not defined
>
> Here is my program:
>
> from tkinter import *
> class CounterButton(Button):
>     def __init__(self, window):
>        super(CounterButton,self).__init__(window, text = "0", 
> command=self.startCounter)
>
>     def startCounter(self):
>         counter = int(self["text"])
>         counter +=1
>         counterLabel["text"] = str(counter)
This should be:
           self["text"] = str(counter)
>
> window = Tk()
> window.title("counter")
...
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to