QuestionQuestion

Utilizing Kivy, we are to modify the attached code for the following functionality.
   
1. Upon opening the program, a white circle with a line-width of '1' is to be drawn at the center of the app window.
   
2. The drawing functionality should remain, and the user should be able to draw or 'trace' over the white circle, as if it existed on a rear-layered canvas.
   
3. When the 'New' button is clicked/touched, the image of the traced-over circle should be captured and saved (e.g. using 'pygame.image.save()') prior to the user drawn lines being cleared from the canvas.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

from random import random
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.graphics import *
import os.path

class FreeHandWidget(Widget):

    def __init__(self, **kwargs):
       super(FreeHandWidget, self).__init__(**kwargs)
       self.size = [800,600]
       self.draw_circle()

    def draw_circle(self):
       self.canvas.add(Color(1.,1.,1.))
       self.canvas.add(Ellipse(pos=(300,200),size=(200,200)))
       self.canvas.add(Color(0,0,0))
       self.canvas.add(Ellipse(pos=(301,201),size=(198,198)))

    def on_touch_down(self, touch):
       color = (random(), 1, 1)
       with self.canvas:
            Color(*color, mode='hsv')...

By purchasing this solution you'll be able to access the following files:
Solution.py.

$38.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats