Tkinter, add pressed buttons onto string display string, how to?

skanemupp at yahoo.se skanemupp at yahoo.se
Sat Apr 5 16:17:45 EDT 2008


> input = "hello"
> input += " world"
> print input

this i know. im wondering how to handle the variable in the actual
program. this exception i get:
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__
    return self.func(*args)
  File "C:\Users\saftarn\Desktop\guiexperiments\calculatorGUI.py",
line 48, in <lambda>
    self.btnDisplay = Button(self,text='+',command=lambda
n="+":self.Display(n),width=1,height=1)
  File "C:\Users\saftarn\Desktop\guiexperiments\calculatorGUI.py",
line 92, in Display
    str = number + str
UnboundLocalError: local variable 'str' referenced before assignment


> A caculator program is pretty complex.  Based on your rudimentary
> questions, I don't think you have enough programming experience to
> tackle a project like that yet.

nah ill be fine. im new to python, not to programming.



More information about the Python-list mailing list