Hi I am having a problem with the "nextz" part "Click Here to see the new winning number." I want to kill this button after it shows the winning number. but it prints another number every time I click the button.
how can i click once show once.
Thanks for any help.
from tkinter import*
import sys, random, tkinter
ticket_price = 2
ticket_entry = 0
nextx = 0
L=0
g=0
f=0
i=0
stop=None
total = 0
end=None
def calculatetotals():
valid = set('12345')
ticket_entry = tik.get()
if ticket_entry not in valid:
print('We permit values in {}.'.format(valid))
label4 = Label(aApp,text = 'We permit values in 1, 2, 3, 4 or 5!',fg = 'blue').grid(row=7,column=1)
else:
label4 = Label(aApp,text = ' ',fg = 'blue').grid(row=7,column=1)
mytik=int(ticket_entry)
total = mytik*ticket_price
Label(aApp,text= "You purchased:$%.2f \n" % total).grid(row=7,column=2)
Label(aApp,text= "\nNumber Of Tckets: %.f\n" % mytik).grid(row=6,column=1)
Button(aApp,text="Click Here To Draw Your Tickets!",fg='blue',bg='white',command = nextx).grid(row=8,column=1)
aApp=Tk()
aApp.geometry('350x200+150+250')
aApp.title("LOTTO")
tik=StringVar()
label1 = Label(aApp,text = "Welcome To Lotto.",fg = 'blue')
label1.grid(row=0,column=2)
label2=Label(aApp,text="Tickets Are ${:.2f} Each.".format(ticket_price),fg='red')
label2.grid(row=1,column=1)
label3=Label(aApp,text="How Many Would You Like?",fg='black')
label3.grid(row=2,column=1)
mytik = Entry(aApp,textvariable=tik)
mytik.grid(row=2,column=2)
button1=Button(aApp,text="Your Purchse\nClick Here",fg='blue',command=calculatetotals)
button1.grid(row=6,column=1)
def nextx():
Button(aApp,text="Click Here to see the new winning number.",fg='lightgreen',bg='black',command = nextz).grid(row=8,column=1)
ticket_entry = tik.get()
i = 0
while i < int(ticket_entry):
L = list(range(1,60))
random.shuffle(L)
g = L[:5]
g.sort()
f = L[5:6]
drawing = ' '.join( [' - '.join(str(G) for G in g),' - ',str(f[0])])
label5=tkinter.Label(app,text = drawing ).pack(padx=1,pady=2)
i+=1
app=tkinter.Tk()
app.geometry('600x400+75+75')
app.title(string=" NUMBERS ")
Button(app, text="Quit", command=app.quit).pack()
def nextz():
L = list(range(1,60))
random.shuffle(L)
g = L[:5]
g.sort()
f = L[5:6]
drawing = ' '.join( [' - '.join(str(G) for G in g),' - ',str(f[0])])
label6=tkinter.Label(aBpp,text = drawing).pack(padx=1,pady=2)
sys.exit("This is an example of an error message")
return
aBpp=tkinter.Tk()
aBpp.geometry('200x100+705+705')
aBpp.title(string="Winning Number")
Button(aBpp, text="Quit", command=aBpp.quit).pack()
tkinter.mainloop()
app.mainloop()
aApp.mainloop()