I am trying to build a Tkinter app which allows you load documents and then analyse them. I must admit I am still getting to grips with object-oriented programming, so apologies if this is a simple answer.
I have built this Class to hold the filepath variables for the rest of the app to use.
class Inputs:
def __init__(self, CV, JS):
self.CV = CV
self.JS = JS
def cv(self, input):
self.CV = input
def js(self, input):
self.JS = input
However everytime I try to pass the following:
b = ‘CV_test.txt’
Inputs.cv(b)
I get the following error.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-5-f21fa013f9ae>", line 1, in <module>
Inputs.cv(b)
TypeError: cv() missing 1 required positional argument: 'input'
Is it not possible to pass a filepath as a Class variable?
Supplementary question: Will this approach enable me to call on these variables in other classes at a later date?