1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Paladinen [302]
3 years ago
6

Create a program that draws a rectangle whenever you click the mouse. The rectangle should have a width of 30 and a height of 50

and be centered at the place where the user clicks. Remember, the position of a rectangle is the top left corner. To place the rectangle at the center of the click, you will need to adjust the position.
Computers and Technology
1 answer:
Alinara [238K]3 years ago
6 0

Answer:

RECT_HEIGHT = 50

RECT_WIDTH = 30

rect = Rectangle(50,30)

       

# random.choice returns a random value from the COLORS

# function will draw a rectangle at x, y

def draw_rect(x, y):

   rectangle = Rect(50, 30)

   rect.set_position(x, y)

   rect.set_color(Color.green)

   add(rect)

# Link to the mouse click event

   add_mouse_click_handler(draw_rect)

Explanation: Hope this works for you.

You might be interested in
You have a site (Site1) that has about 20 users. For the last few months, users at Site1 have been complaining about the perform
SIZIF [17.4K]
Upgrade Site1's (probably WAN) network connection.
6 0
3 years ago
Advantages and disadvantages of technology
Elina [12.6K]
Technology has a lot of advantages and disadvantages. Few of notable advantages of technology are the fast and easy access to information with the help of internet, the improvised ways of communication like e-mails, and the gadgets or software applications to speed up work. For the disadvantages, the most noticeable effect is the technology related diseases such as the blurring vision caused from the radiation of mobile phones.
6 0
3 years ago
What is variable declaration in java ​
Airida [17]

Answer:

A variable declaration is a name given to a memory location. It is the basic unit of storage in a program.

8 0
3 years ago
Read 2 more answers
Which of these skills are used in game design?
olasank [31]

Answer:

I think the answer is Writing but am not sure

8 0
3 years ago
Which of the following is not a basic role of a webmaster
Natalija [7]
Out of the following, the only one that I see is not the basic role of a webmaster is replying to customers questions about the web site! Usually they have a specific job for that; like customer service etc. Hopefully that helps.
5 0
4 years ago
Other questions:
  • A ____ document identifies the purpose of the program being developed, the application title, the procedures to be followed when
    11·1 answer
  • In this assignment, you are going to add conditional formatting to the spreadsheet you used in the previous
    13·1 answer
  • The term ________ refers to the use of a single unifying device that handles media, internet, entertainment, and telephone needs
    13·1 answer
  • What is the slogan of the sociological school of criticism ?​
    9·1 answer
  • While using the CLI on a Windows 10 64-bit computer with a single HDD and a single volume, you want to move from the current dir
    15·1 answer
  • There is a simple pattern for derermining if a binary number is odd. What is it and why does this pattern occur?
    8·1 answer
  • Mobile app designers who work for themselves are often dubbed _____.
    10·1 answer
  • What game is this? help mee?
    8·2 answers
  • Frank enters "1" in the field for postal code. What is frank most likely trying to do?
    13·2 answers
  • You want to send an email to members of your team working on a school project. In which field would you put the email addresses
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!