Apr-22-2019, 12:36 PM
l = Button(r, text="gæt2", command=radsa, compound=CENTER)
line 81, command will call radsa without arguments, thus causing the error.
you need to pass arguments:
There are a couple of ways to do this, the cleanest is with partial
1. With use of partial:
- At top of script, add
from functools import partial
- Then before button definition, add:
pcommand = partial(radsa, guessesTaken, randnummer, gæt): l = Button(r, text="gæt2", command=pcommand, compound=CENTER)
- This is untested but should work
The other is using lambda:
l = Button(r, text="gæt2", command=lambda: radsa(guessesTaken, randnummer, gæt), compound=CENTER)In either case, you need to make sure argument values are available when called.