I have a 2D list containing information about items that the user has added in (like the name of the item, the type, the color etc.). I now want to make a class with all the parameters of the items, I then want to create an object for each item that the user has added in (with all of it's statistics)
What I have in mind is something like this:
clothing_list = [["Black T-Shirt", "Black", "T-Shirt", "Light", "One-Colored"], ["Dark Gray NASA Hoodie", "Dark Gray", "Hoodie", "Warm", "Print"]]
class Clothing:
def __init__(self, name, color, type, tag, pattern):
self.name = name
self.color = color
self.type = type
self.tag = tag
self.pattern = pattern
@classmethod
def get_user_input(self):
while 1:
try:
#Getting input from Tkinter
name = input_name.get()
color = get_color.get()
type = get_type.get()
tag = get_tag.get()
pattern = get_pattern.get()
except:
print("Unable to get user input")
contunie
After this I somehow want to be able to create an object with their individual stats from the 2D list.
I'm not even sure if this is possible and if it isn't then I'll have to rethink:)