Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Python Expert

Topic: Python - Tkinter

I have a Tinter interactive animation program where I should do a number of specific features. For example, a rotating sticks animation is already set. I have to add the following feature "Pressing "z" teleports a random stick to a random location."

PlanetMoons - Look at the interactive animation program below, then add the following features to it.

1) Even moons are red, odd moons are yellow. Start conting from 0, so the first moon is red. Do not assume there are exactly 3 moons: there could be more or less.

2) A mouse click teleports the planet to the location of the click.

3) "z" makes the last moon 10% faster; "x" makes it 10% slower; "c" inverts its rotation.

4) "a" creates a new moon that is 30 steps further away from the last moon, with initial angle 0 and initial speed 1; "s" deletes the last moon, but the very first moon can never be deleted.

5) "1" turns the planet green; "2" blue; "3" brown. The initial color of the planet is brown.''

6) The planet contains the text "CMU" centered on it.

7) If the mouse click is inside the planet, the planet is not teleported but it turns purple. Otherwise the planet is teleported to the click location.

8) "v" inverts the rotation of all the moons.

9) "r" resets the animation to the initial state.

10) "b" doubles the speed of the slowest moon (be careful with signs: for example, a moon with speed -5.0 is faster than than a moon with speed 2.0. You can use the function abs(x) to get the absolute value of a number x)

11) "n" makes the planet's radius 10 units larger, "m" makes it 10 units smaller. The planet can never become smaller than 10 units.

The distances of all the moons are also increased/decreased of the same amount. Make sure all the functionalities still work properly when the planet is bigger/smaller (like the detection of a click inside the planet).

12) Moons that are slower than 2.0 rad/s (in any direction) turn blue.

13) "d" slows down all the moons by 30%.

14) "f" switches the text inside the planet from "CMU" to "Qatar". Pressing "f" again switches it back to "CMU".

15) Clicking inside a moon makes the planet turn pink (and prevents it from being teleported). Hint: you can find the math formula to calculate the position of the moons in the redrawAll() function.

16) The background of the game is a black starry sky, with 20 stars randomly placed at the beginning of the game. To draw a star, use the provided function drawStar(x, y).

Rotating Sticks - Look at the interactive animation program below, then add the following features to it.

Note: You can assume the canvas is 600x400 pixels.

1) Sticks that rotate clockwise are blue, those that rotate counterclockwise are red.

2) Clicking the mouse makes all the sticks move 10% closer to the location of the click.

3) Pressing "z" teleports a random stick to a random location.

4) pressing "x" creates a new stick in a random location, with a random length between 50 and 150, initial angle 0, and random angular velocity between -5.0 and 5.0. Hint: random.random() returns a float between 0.0 and 1.0.

5) Pressing "c" merges the first two sticks. The resulting stick is located at the middle point between the two original sticks; its length is the average of the two original lengths; its angle and angular velocity are the average of those of the two original sticks. If there are fewer than 2 sticks in the game, "c" has no effect.

6) Pressing "v" aligns all the sticks horizontally to the middle line of the canvas, spaced uniformly. The order of the sticks doesn't matter.

7) Pressing "b" will draw a green closed polygonal line that joins the centers of all the sticks. Pressing "b" again will make it disappear.

SpringFlowers

Explore the interactive animation program below, then add the following features to it:

1) A counter at the top right corner of the screen shows the current number of flowers.

2) Clicking inside the ground creates a new random flower at the location of the click.

Hint: use the function createRandomFlower() (already written for you) and modify the flower that it returns. Then use the function addFlowerInOrder() (also already written for you) to place the new flower in the correct position in the flower list.

3) Pressing "z" makes all the current flowers that are not already withering start to wither. Hint: a flower starts to wither when its age reaches 80% of its lifespan.

4) Pressing "x" makes the smallest flower twice as big. Make sure that your program does not crash if there are no flowers in the game.

5) Pressing "v" deletes all the flowers that are not red or yellow.

6) Every time you press "c" the ground changes color. The color rotates in this order: "tan" -> "green" -> "black" -> "gray" -> "white" -> "tan"

7) Pressing "b" moves all the flowers horizontally 20 units to the right. If a flower falls outside the right margin of the screen (i.e., 800) it appears again at the left margin (i.e., 0).

8) Pressing "n" stops the automatic creation of new flowers; pressing "n" again resumes it.

9) Pressing "a" makes a yellow sun appear on the upper left corner of the screen. Pressing "a" again makes it disappear. The sun is a disc centered at (70, 70) and its radius is randomly selected between 20 and 60 when "a" is pressed.

10) Each flower has a third leaf on the left side. This leaf is attached at 1/3 of the height of the stem, and its size is the average of the size of the other two leaves.

11) Clicking on the sky makes clouds appear at the locations of the clicks. A function that draws one cloud is already written for you (look after redrawAll()).

12) Clicking on the sky makes clouds appear at the locations of the clicks. A function that draws one cloud is already written for you (look after redrawAll()).

13) A counter at the bottom right corner of the screen shows the total number of flowers that ever existed since the beginning of the game.

Attachment:- Assignment.zip

Python, Programming

  • Category:- Python
  • Reference No.:- M92020107

Have any Question?


Related Questions in Python

Lab assignment -background - we have discussed in detail

Lab Assignment - Background - We have discussed, in detail, the function of Stacks and Queues and how they are specifically implemented in Python. To get a better understanding of the utility of these data structures, we ...

Question write a python program with a graphical user

Question: Write a python program with a graphical user interface that will allow a user to create a custom pizza which they wish to order. At minimum, the user should be able to choose the size of the pizza, the type of ...

Architecture and system integrationcase study queensland

Architecture and System Integration Case Study: Queensland Health - eHealth Investment Strategy After evaluating various platforms, Queensland Health finally decided to adopt a Service Oriented Architecture (SOA) for its ...

Architecture and system integrationcase study queensland

Architecture and System Integration Case Study: Queensland Health - eHealth Investment Strategy After evaluating various platforms, Queensland Health finally decided to adopt a Service Oriented Architecture (SOA) for its ...

Show times in tmus and seconds1 an associate grasps an oven

Show times in TMUs and seconds. 1. An associate grasps an oven door within reach and pulls it open 18 inches with the left hand (he does not relinquish control of the door). With a pan in the right hand, he carefully pos ...

Simple python traffic lightswrite a program that simulates

Simple Python (Traffic lights) Write a program that simulates a traffic light. The program lets the user select one of three lights: red, yellow, or green. When a radio button is selected, the light is turned on, and onl ...

Homework -this homework will have both a short written and

Homework - This homework will have, both a short written and coding assignment. The problems that are supposed to be written are clearly marked. 1) (Written) Make heuristics Describe two heuristics for the slide problem ...

Question why is software configuration management

Question : Why is software configuration management considered an umbrella activity in software engineering? Please include examples and supporting discussion. The response must be typed, single spaced, must be in times ...

Tasksdemonstrate data scraping of a social network of

Tasks Demonstrate data scraping of a social network of choice. Develop technical documentation, including the development of the code & detailing the results. Provide a report on the findings, that includes research into ...

Quesiton write a python script that counts occurrences of

Quesiton: Write a python script that counts occurrences of words in a file. • The script expects two command-line arguments: the name of an input file and a threshold (an integer). Here is an example of how to run the sc ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As