Apr-29-2017, 02:26 PM
(Apr-29-2017, 01:14 PM)JohnNo Wrote: #2 well i edited the code
no error but it prints nothing
return zeroo + 1 print(zeroo)
Of coarse it prints nothing, you return from the function before ever trying to print anything.
Aside from that, though, try to avoid global variables. It might be a hassle at first, but it'll make your life much better later on :)
All the cool kids have posted code, so here's some from me, too:
>>> import tkinter as tk >>> class Counter(object): ... def __init__(self, start: int = 0): ... self.value = start ... def add(self) -> int: ... if self.value < 900: ... self.value += 1 ... print(self.value) ... return self.value ... >>> clicks = Counter() >>> root = tk.Tk() >>> tk.Button(root, text="click me!", command=clicks.add).pack() >>> root.mainloop() 1 2 3 4 5 6 >>>