Hey guys,
I will ask in english so maybe more dev's can understand my problem properly.
So as in topic Python is trolling me.
I got 2 functions, very similar the first is working fine and the second gives me a very strange errror.
Function 1:
Python
- def LoadCategories(self):
- self.categoryListBox.RemoveAllItems()
- self.categoryItemsDict = {}
- categories = [
- [0, "Alles"],
- [1, "Waffen"],
- [2, "Ruestungen"],
- [3, "Schmuck"],
- [4, "Kostueme"],
- [5, "Upp-Items"],
- [6, "Fertigkeitsbuecher"],
- [7, "Sonstiges"],
- ]
- for category in categories:
- nr = category[0]
- name = category[1]
- newCategory = self.Category(nr)
- newCategory.SetParent(self.categoryListBox)
- newCategory.SetText(name)
- newCategory.SAFE_SetEvent(self.SelectCategory, nr)
- newCategory.Show()
- self.categoryItemsDict.update({nr : newCategory})
- self.categoryListBox.AppendItem(newCategory)
Function 2:
Python
- def RefreshSellingItems(self):
- self.itemsListBox.RemoveAllItems()
- self.sellingItemsDict = {}
- sellingItems = [
- [0, 19, 300000, "Sanii"],
- [1, 29, 300000, "Sanii"],
- [2, 39, 300000, "Fliege"],
- [3, 149, 300000, "Spacken"],
- [4, 189, 300000, "DerFlamer1337"],
- [5, 3009, 300000, "Sanii"],
- ]
- for sellingItem in sellingItems:
- id = sellingItem[0]
- vnum = sellingItem[1]
- price = sellingItem[2]
- seller = sellingItem[3]
- newItem = self.SellingItem(vnum, price, seller)
- newItem.SetParent(self.itemsListBox)
- newItem.SAFE_SetEvent(self.SelectItem, id)
- newItem.Show()
- self.sellingItemsDict.update({id : newItem})
- self.itemsListBox.AppendItem(newItem)
The RefreshSellingItems is giving me the following error:
TypeError: an integer is required and it's telling me that the mistake is in this line: for sellingItem in sellingItems:
I don't get it why. I already tested loop logic in a simple test file:
Python
- categories = [
- [0, "Alles"],
- [1, "Waffen"],
- [2, "Ruestungen"],
- [3, "Schmuck"],
- [4, "Kostueme"],
- [5, "Upp-Items"],
- [6, "Fertigkeitsbuecher"],
- [7, "Sonstiges"],
- ]
- for cat in categories:
- print cat[0], cat[1]
- sellingItems = [
- [0, 19, 300000, "Sanii"],
- [1, 29, 300000, "Sanii"],
- [2, 39, 300000, "Sanii"],
- [3, 149, 300000, "Sanii"],
- [4, 189, 300000, "Sanii"],
- [5, 3009, 300000, "Sanii"],
- ]
- for sellingItem in sellingItems:
- print sellingItem[0], sellingItem[1], sellingItem[2], sellingItem[3]
Result:
Bitte melden Sie sich an, um dieses Bild zu sehen.
I hope someone can help, im very stucked at my new system now because of this damn error.
Thanks!