#đŸ”’ hello who can help me with turtle i can't make a circle in my square

49 messages · Page 1 of 1 (latest)

balmy jacinth
#

def fond_case(xc, yc, couleur):
# Dessiner un carré sans bord de couleur couleur pour une case de taille xc en abscisse et yc en ordonnée
turtle.penup()
turtle.goto(xc, yc)
turtle.pendown()
turtle.fillcolor(couleur)
turtle.begin_fill()
for _ in range(4):
turtle.forward(xc)
turtle.right(90)
turtle.end_fill()
turtle.penup()
turtle.goto(xc, yc)
turtle.pendown()
fond_case(50,50,"red")

def motif_cercle(xc, yc, motif):
turtle.penup()
turtle.goto(xc + xc/2, yc + yc/2)
turtle.fillcolor("black")
turtle.begin_fill()
turtle.circle(xc/2 - 10)
turtle.end_fill()
turtle.penup()
turtle.goto(xc, yc)
turtle.pendown()

motif_cercle(100, 100, "dessiner_cercle")

keen lindenBOT
#

Hey @balmy jacinth!

It looks like you're trying to paste code into this channel.

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
keen lindenBOT
#

@balmy jacinth

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

raw temple
balmy jacinth
#

Write a function ' motif case(x c, y c, motif) which applies motif to the center of the case.

raw temple
balmy jacinth
#

def fond_case(xc, yc, couleur):

Move the turtle to the top-left corner of the square

turtle.penup() # Lift the pen of the turtle
turtle.goto(xc, yc) # Move the turtle to the top-left corner
turtle.pendown()
turtle.fillcolor(couleur)
turtle.begin_fill()
for _ in range(4):
turtle.forward(xc) # Move the turtle forward by the x-coordinate of the square
turtle.right(90) # Turn the turtle right by 90 degrees
turtle.end_fill()
turtle.penup()
turtle.goto(xc, yc) # Move the turtle back to the top-left corner
turtle.pendown()

fond_case(50,50,"red")

def motif_cercle(xc, yc, motif):
turtle.penup()
turtle.goto(xc + xc/2, yc + yc/2)
turtle.fillcolor("black")
turtle.begin_fill()
turtle.circle(xc/2 - 10) # Draw a circle with a radius of half the x-coordinate minus 10
turtle.end_fill()
turtle.penup()
turtle.goto(xc, yc)
turtle.pendown()

motif_cercle(100, 100, "dessiner_cercle")

keen lindenBOT
#

Hey @balmy jacinth!

It looks like you're trying to paste code into this channel.

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
balmy jacinth
#

@raw temple

storm gyro
#

You have to edit the message so the first line is ```py and the last line is ``` so the code shows up like the example @balmy jacinth

#

Otherwise it doesn't look right and we can't tell if you are indenting the code properly and such.

#

!paste You can also paste it here instead.

keen lindenBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

balmy jacinth
#

i dont understand

storm gyro
#
def foo():
  pass
#

You want your code here to look something like that. Or if you don't want to mess around with markdown you can go to that paste site and paste your code there. It will give you a new URL you can share so we can see your code.

balmy jacinth
#

import turtle

def fond_case(xc, yc, couleur):
# Dessiner un carré sans bord de couleur couleur pour une case de taille xc en abscisse et yc en ordonnée
turtle.penup()
turtle.goto(xc, yc)
turtle.pendown()
turtle.fillcolor(couleur)
turtle.begin_fill()
for _ in range(4):
turtle.forward(xc)
turtle.right(90)
turtle.end_fill()
turtle.penup()
turtle.goto(xc, yc)
turtle.pendown()
fond_case(50,50,"red")

def motif_cercle(xc, yc, motif):
turtle.penup()
turtle.goto(xc + xc/2, yc + yc/2)
turtle.fillcolor("black")
turtle.begin_fill()
turtle.circle(xc/2 - 10)
turtle.end_fill()
turtle.penup()
turtle.goto(xc, yc)
turtle.pendown()

motif_cercle(100, 100, "dessiner_cercle")

keen lindenBOT
#

Hey @balmy jacinth!

It looks like you're trying to paste code into this channel.

Discord has support for Markdown, which allows you to post code with full syntax highlighting. Please use these whenever you paste code, as this helps improve the legibility and makes it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
raw temple
#

You have the coordinates of where your circle is being drawn, and the coordinates of where your box is being drawn. Why can't you update the values of one of those so they're in the same place?

balmy jacinth
#

I tried but couldn't make it work

raw temple
#

Can you show what you tried?

#

Keep trying to adjust the values

balmy jacinth
raw temple
#

Ok, keep adjusting

balmy jacinth
raw temple
#

ok now just don't move your turtle as high up when you draw the circle

balmy jacinth
#

thannnnnnnnnnnnnnnnnnnnnks

raw temple
#

The solution is very overengineered though

balmy jacinth
raw temple
#

Should the circle perfectly fill the box like this?

balmy jacinth
#

Not as a pawn

#

it good

#

@raw temple

raw temple
balmy jacinth
#

it 's good

#

Ecrivez une fonction ´ dessine bord(x c, y c,coul bord,taille bord) qui place un bord de largeur
taille bord de couleur coul bord le long des 4 cot´es de la case (`a l’interieur de la case).
Quelle conditions vous semble-il logique de supposer sur taille bord et coul bord?

raw temple
balmy jacinth
#

ok

#

Write a function ' draw edge(x c, y c,coul edge,taille edge) which places an edge of width taille edge of color coul edge along the 4 sides of the square (inside the square). What conditions do you think it makes sense to assume for taille bord and coul bord?

#

@raw temple

#

@raw temple

raw temple
#

Please stop pinging me, I'm not your servant

balmy jacinth
#

sorry

keen lindenBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.