cartman6921
2015-05-18 18:27:30 UTC
*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.
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
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.
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor