How could I pass value entered by user, using tkinter’s Entry to another object?
I manage to print it, but couldn’t sent it further…
Here are parts of the code:
def novo_vreme():
vreme1 = Vreme()
root1 = Toplevel(root)
root1.title("Vreme")
naziv = "Vreme"
L1 = Label(root1, text="Zadržavanje: ")
L1.place(x=10, y=30)
E1 = Entry(root1, bd = 2)
E1.insert(0, vreme1.vreme)
E1.place(x=100, y=30)
root1.geometry("%dx%d+300+200" % (w/2, h/5))
Button(root1, text="OK", command = lambda: izmeni(E1.get(),root1,vreme1,naziv), width=10).place(x=130, y=65)
root1.mainloop()
def izmeni(a,root1,vreme1,naziv):
try:
a = float(a)
if a==0:
if (messagebox.askretrycancel(title="Greska",parent = root1,
message="Vrednost ne moze biti nula!") == 1):
return
else:
root1.destroy()
else:
vreme1.izmeni(a)
naziv=root1.title()
root1.destroy()
okret(naziv,vreme1)
except:
if (messagebox.askretrycancel(title="Greska",parent = root1,
message="Unete vrednosti moraju biti brojevi!") == 1):
return
else:
root1.destroy()
And from that, I passed value to:
class Program(object):
"""Standardni rezimi rada"""
def __init__(self, ugao):
self.ugao = ugao
def okret(naziv, vreme1):
a = vreme1.vreme
print(a)
and printed it, but, now I need to send a value in object:
def rezim(self):
…
x = a
sleep(int(x))