Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6823959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:50:44+00:00 2026-05-26T21:50:44+00:00

I have searched for the problem I am having, but have seen different variations

  • 0

I have searched for the problem I am having, but have seen different variations of it that don’t help me much (I am fairly new to Python; taking it as part of an introduction to programming at a university).

The Problem: I keep getting a TypeError talking about the number of arguments, but I (with my so far limited knowledge of Python) do not see what is wrong.

I have the following functions:

def Grid():
borderSet = 20
spaceSize = 50
totalSpaces = 10

boardX = borderSet + (totalSpaces * spaceSize) + (10 * borderSet)
boardY = borderSet + (totalSpaces * spaceSize) + borderSet

board = GraphWin("Hunt the Wumpus", boardX, boardY)

for r in range(totalSpaces):
    for c in range(totalSpaces):
        gridTile = Rectangle(Point(borderSet+ r*spaceSize, borderSet+c*spaceSize), Point(borderSet+(r+1)*spaceSize, borderSet+(c+1)*spaceSize))
        gridTile.setWidth(2)
        gridTile.draw(board)
        gridTileText = Text(Point(((gridTile.getP1().getX() + gridTile.getP2().getX()) / 2), ((gridTile.getP1().getY() + gridTile.getP2().getY()) / 2)), False)
        gridTileText.draw(board)

ctr = DrawCharacter(borderSet, spaceSize)
ctr.draw(board)

a, w, p, t = ChooseDifficulty(boardX, boardY)

Text(Point(boardX - (6 * borderSet), 15 * borderSet), ("Number of arrows:", a)).draw(board)
Text(Point(boardX - (6 * borderSet), 16 * borderSet), ("Number of wumpii:", w)).draw(board)
Text(Point(boardX - (6 * borderSet), 17 * borderSet), ("Number of pits:", p)).draw(board)
Text(Point(boardX - (6 * borderSet), 18 * borderSet), ("Number of treasures:", t)).draw(board)

gW, gWT, gE, gET = Controls(boardX, boardY, borderSet)
gW.draw(board)
gWT.draw(board)
gE.draw(board)
gET.draw(board)
#gN.draw(board)
#gNT.draw(board)
#gS.draw(board)
#gST.draw(board)

click = board.getMouse()

#moveN = rectIntersect(gN, click)
#moveS = rectIntersect(gS, click)
moveE = rectIntersect(gE, click)
moveW = rectIntersect(gW, click)

board.getMouse()

Text(Point(boardX / 2, boardY / 2), (moveE, moveW)).draw(board)

board.getMouse()

ch = MoveCharacter(ctr, moveE, moveW)
ch.draw(board)

board.getMouse()
board.close()

return boardX, boardY

and

def Controls(bX, bY, bS):
    wP = [Point(bX - (10 * bS) + 5, bS + 80), Point(bX - (10 * bS) + 105, bS + 120)]
    eP = [Point(bX - (10 * bS) + 120, bS + 80), Point(bX - (10 * bS) + 220, bS + 120)]

    goWest = Rectangle(wP)
    goWestText = Text(Point(bX - (10 * bS) + 55, bS + 100), "Turn Left")
    goWestText.setStyle("bold")
    goWest.setFill(color_rgb(190, 30, 10))
    goWestText.setFill(color_rgb(255, 255, 255))

    goEast = Rectangle(eP)
    goEastText = Text(Point(bX - (10 * bS) + 145, bS + 100), "Turn Right")
    goEastText.setStyle("bold")
    goEast.setFill(color_rgb(10, 190, 30))

    return goWest, goWestText, goEast, goEastText

and I get the following error:

Traceback (most recent call last):
  File "<pyshell#15>", line 1, in <module>
    Grid()
  File "<pyshell#5>", line 29, in Grid
    gW, gWT, gE, gET = Controls(boardX, boardY, borderSet)
  File "<pyshell#11>", line 10, in Controls
    goWest = Rectangle(wP)
TypeError: __init__() takes exactly 3 arguments (2 given)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:50:44+00:00Added an answer on May 26, 2026 at 9:50 pm

    It’s hard to tell because you’ve provided so much code, but I believe what’s going on is this:

    wP = [Point(bX - (10 * bS) + 5, bS + 80), Point(bX - (10 * bS) + 105, bS + 120)]
    

    This makes wP a list of two elements. Even though it contains two things, it’s still a single object.

    goWest = Rectangle(wP)
    

    I’m guessing that the Rectangle constructor is supposed to be passed two points as arguments. Along with the implicit self parameter that always refers to the object itself, that makes a total of 3 arguments. Python is complaining that it’s only seeing two parameters passed, namely the implicit self and your list wP.

    If this is in fact the problem, one way to fix this would be

    goWest = Rectangle(wP[0], wP[1])
    

    A slightly more advanced way would be

    goWest = Rectangle(*wP)
    

    The * (argument unpacking) operator basically automates the process of expanding the list elements into individual arguments. f(*args) is equivalent to

    f(args[0], args[1], args[2], ...)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched/Googled around but I'm struggling with the following problem. I am building
I have searched but cannot find the answer to a frustrating problem of mine.
I'm having a problem with my HTML. I've searched all over the internet, but
Ok, So I've googled this problem and I have searched stack overflow but I
I have searched and not found any clear answers to a problem im having.
I am having a weird problem with the autocomplete UI. I have searched on
I'm having a problem, which already searched the internet but can not solve. I
I have searched for hours now and haven't found a solution for my problem.
I have searched around, and it seems that this is a limitation in MS
I have searched but apparently my google foo is weak. What I need is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.