Advertisement
Kapa3a

Fix private shop

Dec 4th, 2023
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.72 KB | Source Code | 0 0
  1. Before I tell you the solution, you need to understand exactly what the problem is:
  2.  
  3. Open() takes exactly 3 arguments (2 given)
  4. This means that a function is expecting to recieve 3 informations:
  5.  
  6. def new_func(arg1, arg2, arg3):
  7.   print("this func works!")
  8.  
  9. # new_func(1, 2) # This won't work because we're only sending 2 infos
  10.  
  11. new_func(1, 2, 3) # This will work since the func is expecting 3 arguments
  12.  
  13.  
  14. Now, with that in mind, let's indentify the problem:
  15.  
  16. # So, we know that the open is getting 3 arguments
  17. def Open(self, title,days):
  18.  
  19. # And we're calling the function with this:
  20. self.privateShopBuilder.Open(self.inputDialog.GetText())
  21.  
  22. We now know that it's wrong since the function is expecting 3 infos and we are sending it once
  23.  
  24. This means that we probably want to do this... right?
  25.  
  26. self.privateShopBuilder.Open(1, 2, 3)
  27. Well, yes (the logical is correct) but in this case, it's wrong.
  28.  
  29. In the beginning of the function, notice the word self. I can go to a deep explanation but it's not relevant to the topic. Let's just say you can ignore since it's used to represent the class where the function is.
  30.  
  31.  
  32.  
  33. But what does that mean?
  34.  
  35. Remember the initial error?
  36.  
  37. Open() takes exactly 3 arguments (2 given)
  38. The function is recieving 2 arguments: self and title.
  39.  
  40.  
  41.  
  42. We need to send 2 infos, instead of 1:
  43.  
  44. def Open(self, title,days): # title and days
  45. self.privateShopBuilder.Open(self.inputDialog.GetText()) # we're ONLY sending title, where's the "days"?
  46. You probably didn't follow the tutorial at interfarcemodule.py, check the files again.
  47.  
  48.  
  49.  
  50. Quick solution:
  51.  
  52. self.privateShopBuilder.Open(self.inputDialog.GetText(), 1) # The 1 represents the day, probably how many days to open an offline shop (?)
  53.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement