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
A line of code that begins with the while needs to end which symbol?<br> # <br> "<br> :<br> .
olga_2 [115]
<h2>A line of code that begins with the "while" needs to end with <u>":"</u> symbol</h2>

Explanation:

In python, the while loop statement has ":" at the end of the line.

<u>Syntax:</u>

while expression:

code(s) or statement(s)

<u>Example:</u>

cnt = 0

while (cnt < 5):

  print 'cnt:', cnt

  cnt = cnt + 1

Like other programming languages, while loop works in the same way except that in python it comes alone with "else" statement. When the condition is false, "else" statement gets executed.

<u>Example:</u>

#!/usr/bin/python

cnt = 0

while cnt < 5:

  print cnt, " is  less than 5"

  cnt = cnt + 1

else:

  print cnt, " is not less than 5"

3 0
3 years ago
What is computer-aided design/computer-aided manufacturing (CAD/CAM)? a.A cultural trend that places value on an individual's ab
masha68 [24]

Answer:

C. RFID tag Systems are used to create the digital designs and then manufacture the products

7 0
4 years ago
On Brainly, how can I change my username? from halfsidepancake​
klio [65]

Answer:

unfortunately you cant change your username.... i tried 2 and the only way is to make a new account

Explanation:

8 0
3 years ago
Read 2 more answers
Plz answer me will mark as brainliest ​
Vesnalui [34]
I’m pretty sure the answer for 1 is B.
And the answer for 2 is True.
4 0
3 years ago
What does it mean by null in programming?
Marysya12 [62]
In computer programming<span>, </span>null<span> is both a value and a pointer. </span>Null<span> is a built-in constant that has a value of zero. It is the same as the character \0 used to terminate strings in C. </span>Null<span> can also be the value of a pointer, which is the same as zero unless the CPU supports a special bit pattern for a </span>null<span> pointer.</span>
8 0
3 years ago
Other questions:
  • A Molex Connector that connects into a DVD player is easily identifiable by its
    12·2 answers
  • Write a program in java using switch case statement
    11·1 answer
  • Most of us have been using elements of Web 2.0 without even realizing it.<br> True<br> False
    6·1 answer
  • Consider the following code segment.
    12·1 answer
  • Which data type is 2.5?
    5·1 answer
  • I love the brainly update guys! :)
    5·2 answers
  • 4. In a relational database, entities are defined by
    6·1 answer
  • List resource you can utilize if you are experiencing technology issued
    5·1 answer
  • 2. Why do old video games have large pixels and images with jagged edges?
    6·1 answer
  • Which device allows users to directly hear data from a computer
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!