Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97955 > unrolled thread
| Started by | "Harrie Hoenjet" <h.hoenjet@planet.nl> |
|---|---|
| First post | 2015-10-26 19:24 +0100 |
| Last post | 2015-10-26 14:46 -0600 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.python
how to use variable outside function tkinter entry "Harrie Hoenjet" <h.hoenjet@planet.nl> - 2015-10-26 19:24 +0100
Re: how to use variable outside function tkinter entry Peter Pearson <pkpearson@nowhere.invalid> - 2015-10-26 18:58 +0000
Re: how to use variable outside function tkinter entry Randy Day <randy.day@sasktel.netx> - 2015-10-26 14:46 -0600
| From | "Harrie Hoenjet" <h.hoenjet@planet.nl> |
|---|---|
| Date | 2015-10-26 19:24 +0100 |
| Subject | how to use variable outside function tkinter entry |
| Message-ID | <562e7038$0$24168$e4fe514c@news.kpn.nl> |
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.
I want to use the variable wages somewhere else in the programm.
I get weird errors like get() misses argument self
Who can help me?
Harry
[toc] | [next] | [standalone]
| From | Peter Pearson <pkpearson@nowhere.invalid> |
|---|---|
| Date | 2015-10-26 18:58 +0000 |
| Message-ID | <d97bfdFgb5aU1@mid.individual.net> |
| In reply to | #97955 |
On Mon, 26 Oct 2015 19:24:20 +0100, Harrie Hoenjet <h.hoenjet@planet.nl> 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.
[toc] | [prev] | [next] | [standalone]
| From | Randy Day <randy.day@sasktel.netx> |
|---|---|
| Date | 2015-10-26 14:46 -0600 |
| Message-ID | <MPG.30984d1a6fa6188e98968a@freenews.netfront.net> |
| In reply to | #97955 |
> and a function: > def calculate(): > wages = salary.get() > .... > return Are you wanting 'return wages'? You need to tell calculate() what is to return. --- news://freenews.netfront.net/ - complaints: news@netfront.net ---
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web