Answer the question
In order to leave comments, you need to log in
How to do Function Interaction?
def FS():
a = edit1.get()
b = edit2.get()
c = edit3.get()
print(a,b,c)
def Test():
root1 = Tk()
root.title('FTP Host')
label1 = Label(root1,text='H')
label2 = Label(root1,text='L')
label3 = Label(root1,text='P')
label1.grid(row = 0, column = 0)
label2.grid(row = 1, column = 0)
label3.grid(row = 3, column = 0)
edit1 = Entry(root1)
edit2 = Entry(root1)
edit3 = Entry(root1)
edit1.grid(row = 0, column = 1)
edit2.grid(row = 1, column = 1)
edit3.grid(row = 3, column = 1)
b = Button(root1,text='Вычислить',command = FS)
b.grid()
root = Tk()
b2 = Button(root,text='Test',command=Test)
b2.grid()
root.mainloop()
Answer the question
In order to leave comments, you need to log in
global edit1
you need to add it to both functions, in general, read about this operator
They must be in the same class and communicate through it.
>>> class A:
... def f1(self):
... self.x = 1
... def f2(self):
... self.x = 2
... def f3(self):
... print(self.x)
...
>>> a = A()
>>> a.f1()
>>> a.f3()
1
>>> a.f2()
>>> a.f3()
2
>>>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question