Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #97956

Re: how to use variable outside function tkinter entry

From Peter Pearson <pkpearson@nowhere.invalid>
Newsgroups comp.lang.python
Subject Re: how to use variable outside function tkinter entry
Date 2015-10-26 18:58 +0000
Message-ID <d97bfdFgb5aU1@mid.individual.net> (permalink)
References <562e7038$0$24168$e4fe514c@news.kpn.nl>

Show all headers | View raw


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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web