[Tutor] Tkinter help?

cartman6921 cartman6921 at gmail.com
Mon May 18 20:27:30 CEST 2015


*Below is a code made by me in 5 minutes, I am new to Tkinter so am kinda
noobish. as you can see, lemon equals 0 at the start and when you click the
button it adds 1 to the amount lemon equals. After about 15 minutes of
trying and 10 minutes googling i can find nothing to help me. when the code
loops, lemon is set back to 0 again, how do i stop lemon from being set back
to 0.

I need it so if you press the button eg 4 times, lemon=4*

from tkinter import *
root=Tk()

root.title("Lemonade Stand")
root.geometry("500x500+500+300")

lemon=0

def BuyLemon():
    str(lemon)+str(1)
    print(lemon)

button = Button(root,text="Buy Lemon x1", command=BuyLemon)
button.pack()

root.mainloop()




--
View this message in context: http://python.6.x6.nabble.com/Tkinter-help-tp5095151.html
Sent from the Python - tutor mailing list archive at Nabble.com.


More information about the Tutor mailing list