I have seperated my GUI code(ui.py) from the code that does calculations(calcs.py) based on user's GUI entries/selections. Basically, you enter numbers and make selections and then hit start, start button should start calculations and print out stuff. Below are explanations provided with relevant parts of my code:
When you hit the button, below method starts:
import calcs class Application: def sendGUIinput(self): self.entry1 = self.coeff1.get() #get entry 1 self.entry2 = self.coeff2.get() #get entry 2 self.entry3 = self.coeff3.get() #get entry 3 calcs.CreateData(self.entry1, self.entry2) #pass entries 1 and 2 to calcs.py for calculations
Please note that, app = Application(root)
calcs.CreateDatadoes some calculations and then it calls for another class for some other calculations:class CreateData: def __init__(self, entry1, entry2): """some calculations here produce self.someNewVar1 and self.someNewVar2""" CreateData2(self.someNewVar1, self.someNewVar2)This is where I'm having this problem.
calcs.CreateData2takes 2 variables fromcalcs.CreateData, however, it also needsentry3fromApplication.sendGUIinput(). I don't want to pass all the entries toCreateDataand then fromCreateDatatoCreateData2. What I am trying to do is that, having a pool of entries fromui.pyincalcs.pyso that after I press the button, classes incalcs.pycan work without needingui.py. I'll be grateful if you can help me with this. Thank you in advance.
Note: I define calcs.CreateData2 like;
class CreateData2:
def __init__(self, var1, var2):
So it accepts 2 arguments other than self but also needs entry3 from ui.py