Skip to content

Tag: class

do i need to use exactly same attribute names to properties in custom preprocessing class which inherit scikit learn BaseEstimator?

when writing custom classes inherit from BaseEstimator of the sklearn throwing AttributeError: object has no attribute . but that attribute is present and has values. print(null) execute or null. then it throws the above attribute error. traceback shows that this error happens in getattr() in sklearn base. I found that this is caused by attributes that assign to different property

Python Trigger a function when a function is called

So, I am making a desktop app with PyQt6. I have a stylesheet and I want it to update every time I add something to it. Stylesheet is an array and I have multiple functions adding things to it: Now, I want to update the stylesheet every time I call one of these functions (or a function in the class

Issue with class declaration in python. Two classes with fields of each other

My code is something like this: and i have NameError: name ‘className2’ is not defined. I don’t know if there is a declaration in python like in c++, and you can call classes in any order. Please help me… full code: field Speciality.abit is calls AdmissionList and field AdmissionList.speciality calls Speciality. Answer I think i avoid that problem by adding

I am having trouble with enemies in pygame

I have been trying to create an enemy class for my snake game that I can execute in my pygame loop, but my fill_screen() function keeps it so that either one enemy is on the screen at a time, or no enemies are on the screen. I hope someone can help me with this issue, because I have been working