Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Peter Pearson Newsgroups: comp.lang.python Subject: Re: how to use variable outside function tkinter entry Date: 26 Oct 2015 18:58:53 GMT Lines: 30 Message-ID: References: <562e7038$0$24168$e4fe514c@news.kpn.nl> X-Trace: individual.net fJvQ1Ty/X1COmFEDZ1m4/wUBGaTAzqR0ul+owvrVgvI3fIAnBW Cancel-Lock: sha1:hMjY0aQ1Vsv6/aUM4d9kf4Zgtwc= User-Agent: slrn/pre1.0.0-18 (Linux) Xref: csiph.com comp.lang.python:97956 On Mon, 26 Oct 2015 19:24:20 +0100, Harrie Hoenjet wrote: > Hi guys, > suppose i have a tkinter Entry widget (Python 3.4 Tkinter 8.5) > mySalary = Entry(root, textvariable='salary', command=calculate') > > I have defined > salary = IntVar() > > and a function: > def calculate(): > wages = salary.get() > .... > return > > > How can i use the variable wages outside the function calculate? > For example: print(wages) or print (w=calculate()) when I add return wages) > does not work. Huh? "print (w=calculate())" ? What language is this, anyway? Try w = calculate() print(w) and if it doesn't work, report the exact output here. -- To email me, substitute nowhere->runbox, invalid->com.