Last active
September 19, 2023 14:36
-
-
Save xtduong/a374337d7c428cc3b9d381dac43e28f7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import turtle as tur | |
| import colorsys as cs | |
| tur.setup(800, 800) | |
| tur.speed(0) | |
| tur.tracer(10) | |
| tur.width(2) | |
| tur | |
| tur.bgcolor("black") | |
| tur.color("white") | |
| tur.penup() | |
| tur.goto(-300, -300) | |
| tur.pendown() | |
| tur.pensize(1) | |
| tur.goto(300, 300) | |
| tur.goto(-300, 300) | |
| tur.goto(-300, -300) | |
| tur.goto(300, -300) | |
| tur.goto(300, 300) | |
| tur.penup() | |
| tur.goto(-300, -300) | |
| tur.pendown() | |
| tur.pensize(1) | |
| tur.bgcolor("black") | |
| def draw_circle(radius, angle): | |
| tur.penup() | |
| tur.goto(0, 0) | |
| tur.pendown() | |
| tur.circle(radius, angle) | |
| def draw_square(side_length): | |
| tur.penup() | |
| tur.goto(0, 0) | |
| tur.pendown() | |
| for _ in range(4): | |
| tur.forward(side_length) | |
| tur.right(90) | |
| # bAI ! | |
| def tungduong(length, author): | |
| tur.penup() | |
| tur.goto(-300, 0) | |
| tur.pendown() | |
| tur.forward(length) | |
| tur.penup() | |
| tur.goto(-300, -20) | |
| tur.pendown() | |
| tur.write(f"Tác giả: {author}", align="left", font=("Arial", 12, "normal")) | |
| for j in range(25): | |
| for i in range(15): | |
| # Chuyển đổi hệ màu HSV sang RGB và đặt màu cho bút vẽ | |
| r, g, b = cs.hsv_to_rgb(i / 15, 1, 1) | |
| tur.color(r, g, b) | |
| tur.right(90) | |
| draw_circle(200 - j * 4, 90) | |
| tur.left(90) | |
| draw_circle(200 - j * 4, 90) | |
| tur.right(100) | |
| tur.color("red") | |
| tungduong(100, "Tên Tác Giả") | |
| draw_circle(50, 24) | |
| tur.hideturtle() | |
| tur.done() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment