Part B -- Representing Numbers with Rectangles Using PyCharm, use lab11b.py: For this part of the lab, you will modify t

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Part B -- Representing Numbers with Rectangles Using PyCharm, use lab11b.py: For this part of the lab, you will modify t

Post by answerhappygod »

Part B -- Representing Numbers with Rectangles
Using PyCharm, use lab11b.py:
For this part of the lab, you will modify the complete version
of lab10 that you copied in lab11b.py to draw a
rectangle to represent each input number. Then, you repeatedly
accept user's mouse-clicks and if the point of the click is in a
rectangle, you color it 'darkblue'. Here is a demo.
How to do it
Let's use some constant literals.
Each input value, v, will be represented by a
rectangle whose bottom y is base_line_y, its height
is v * height_multiplier, and its width
is rectangle_width. Two adjacent rectangles are
separated by gap_between_rectangles pixels. You
should define the following functions to help you with the
implementation.
A few notes...
As you have noticed, to create an instance of
the Text object, you need an anchor
point and the text to be drawn. If you were to draw a
rectangle around the text that is drawn in the window,
the anchor point is at the center of this
rectangle. In this example, we have placed a red circle at the
anchor point of the text to show this concept.
I need help with this python pseudo-code above,
please!
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply