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))

Once you get the value it is a normal variable and you can do anything with it that you can do to a normal variable. I would suggest that you consider putting everything under one class instead of here's a function, there's a class, here's another function, etc.

try:
    import Tkinter as tk     ## Python 2.x
except ImportError:
    import tkinter as tk     ## Python 3.x

def another_function(input_var):
    print "another function", input_var

class TestClass():
    def __init__(self):
        root1 = tk.Tk()
        root1.title("Vreme")
        naziv = "Vreme"
        L1 = tk.Label(root1, text="Zadržavanje: ")
        L1.place(x=10, y=30)
        self.E1 = tk.Entry(root1, bd = 2)
        self.E1.insert(0, "Test string")
        self.E1.place(x=100, y=30)
        root1.geometry("300x100+300+200")
##    tk.Button(root1, text="OK", command = lambda: izmeni(E1.get(),root1,vreme1,naziv), width=10).place(x=130, y=65)
        tk.Button(root1, text="OK", command = self.izmeni, width=10).place(x=130, y=65)
        root1.mainloop()

    def izmeni(self):
        value = self.E1.get()
        print "izmeni -->", value
        another_function(value)
        self.function_in_class(value)

    def function_in_class(self, input_var):
        print "functionin_class -->", input_var

TC=TestClass()

When I tried it separately , it was ok, that’s what I need, but I couldn’t fit it in code.. I’m new in all of this, so I must ask you to help me with this all the way…? Can I send you complete source code, here in post, or somehow with explanations, I guess it’s not complicated for experienced programmer, but it gives me lots of headache…
Thank you for your time and effort.

I did it, it was a stupid mistake in syntax...
Thanks again...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.