I want to create a Simple Inventory system which shows the item name and quantity in virtual box if the item value is greater than 0, in ascending/descending order of quantity/name (if that is possible).
This is pure python so to display in it a virtual box I would need pure python statement which I am not sure how to do it in this code, where if possible items should be displayed in ascending/descending order of quantity/name .
Python:
init python:
class inventory():
def __init__(self, items, qty):
self.items = items
self.qty = qty
def add_item(self, item):
self.items.append(item)
self.qty += 1
def remove_item(self, item):
self.items.remove(item)
self.qty -= 1
def list_items(self):
if len(self.items) < 1:
for item in self.items:
print(item.name)
class inventoryitem():
def __init__(self, name, desc):
self.name = name
self.desc = desc
Python:
screen inventory_screen():
frame:
xalign 0.5
yalign 0.5
vbox:
xalign 0.5
yalign 0.5
text "virtual box."