Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Avoid Globals?

  1. #1
    New Coder
    Join Date
    Aug 2012
    Thanked 0 Times in 0 Posts

    Avoid Globals?

    We are trying to make a scoring program for a card game which has a variable number of hands played. Using TKinter we need to make an Entry for the score on each hand and then be able to access the data entered in a different function. Have tried looping an exec statement defining multiple Entry boxes, which works, but can't then work out how to access them from another function.
    Any hints gratefully accepted!
    A talent for speaking differently, rather than for arguing well, is the chief instrument of cultural change. Richard Rorty

  2. #2
    New Coder
    Join Date
    Jul 2014
    Auckland New Zealand
    Thanked 0 Times in 0 Posts
    Dated 04-27-2014 I hope I am not late with the answer

    Now first I would like to say June 2014 is the first month I got to learn about Python. (so now we have that clear)

    But I have done some years of C/C++ (however I am yet to write a real C++ program) Then I have done JavaScript, Java, PHP (old version) is HTML a good add-in?,

    if you heed to do some maths functions you need to import the maths "bundle" ( I can not recall what the correct name is) and have this in your code
    import math
    I would declare any global variable in the next line under any "import ???? "
    or failing that maybe the top lines of the page (which is were I would import 's.

    Do not put it just under the
    def main():
    or any other functions you make or that will make it a local variable to just the main function (or to those other functions you come up with.

    From Eric


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts