Changes the position from 0 to the left of the screen. I already tried to modify the degrees and the movement of the arrow but I couldn’t

I’m starting out in programming and I’m having difficulty creating this graph.
`I’m trying to place the graph numbers in order of 0, 45, 90, 174, 178, 90 -45, I’m having trouble placing the 0 to be on the left of the image. If anyone can give me any tips on how to do this, I would be grateful in advance. I’ve already tried a breakpoint to visualize the angle but I didn’t get any results.

enter image description here`

import tkinter as tk
import math

class CircleArrowApp:
def init(self, master):
self.master = master
master.title(“HORSTFX”)

    self.radius = 100  # Sets the initial radius of the circles

    # Creating the first circle and its arrow
    self.canvas1 = tk.Canvas(master, width=400, height=400, bg='white', highlightbackground='goldenrod', highlightthickness=15)
    self.canvas1.pack(side=tk.LEFT, padx=20)
    self.angle1 = 0
    self.arrow1 = None
    self.canvas1.bind("<Configure>", self.on_canvas1_resize)

    # Creation of the second circle and its arrow
    self.canvas2 = tk.Canvas(master, width=400, height=400, bg='white', highlightbackground='goldenrod', highlightthickness=15)
    self.canvas2.pack(side=tk.LEFT, padx=20)
    self.angle2 = 0
    self.arrow2 = None
    self.canvas2.bind("<Configure>", self.on_canvas2_resize)

    # Creating the buttons
    self.button_frame = tk.Frame(master)
    self.button_frame.pack(side=tk.BOTTOM, padx=10)`

    self.start_button = tk.Button(self.button_frame, text="START", width=10, command=self.start_animation)
    self.start_button.pack(side=tk.TOP, pady=10)

    self.stop_button = tk.Button(self.button_frame, text="STOP", width=10, command=self.stop_animation)
    self.stop_button.pack(side=tk.TOP, pady=10)

    self.plus_button = tk.Button(self.button_frame, text="+", width=10, command=self.plus_function)
    self.plus_button.pack(side=tk.TOP, pady=10)

    self.minus_button = tk.Button(self.button_frame, text="-", width=10, command=self.minus_function)
    self.minus_button.pack(side=tk.TOP, pady=10)

    self.animating = False
    self.animate()

def start_animation(self):
    self.animating = True

def stop_animation(self):
    self.animating = False

def plus_function(self):
    self.radius += 10
    self.update_circle_arrows()

def minus_function(self):
    if self.radius > 10:
        self.radius -= 10
        self.update_circle_arrows()

def draw_circle_arrow(self, canvas, angle):
    center_x = canvas.winfo_width() // 2
    center_y = canvas.winfo_height() // 2

    # Set the size of the inner circle relative to the border
    inner_radius = self.radius * 0.8

    # Draw the circle with white fill and yellow border
    canvas.create_oval(center_x - inner_radius, center_y - inner_radius, center_x + inner_radius, center_y + inner_radius, outline='goldenrod', fill='white', width=8)

    # Calculate the arrow's endpoints
    end_x = center_x + inner_radius * math.cos(angle)
    end_y = center_y + inner_radius * math.sin(angle)


    
    # Draw the arrow moving inside the circle
    start_x = center_x
    start_y = center_y
    canvas.create_line(start_x, start_y, end_x, end_y, arrow=tk.LAST, fill='goldenrod', width=6)
    
    if canvas == self.canvas1:
        if self.arrow1:
            canvas.delete(self.arrow1)
        self.arrow1 = canvas.create_line(center_x, center_y, end_x, end_y, arrow=tk.LAST, fill='goldenrod', width=6)
        # Adiciona os números no círculo exterior do canvas1
        outer_radius = inner_radius + 20
        for i in [0, -135, 90, -45, 0, 45, 90, 135, 178]:
            angle_rad = math.radians(-i)
            num_x = center_x + outer_radius * math.cos(angle_rad)
            num_y = center_y + outer_radius * math.sin(angle_rad)
            canvas.create_text(num_x, num_y, text=str(i), fill='black')

        # Draw the outer circle of canvas1
        outer_radius = inner_radius + 2
        canvas.create_oval(center_x - outer_radius, center_y - outer_radius, center_x + outer_radius, center_y + outer_radius, outline='', width=2)
    elif canvas == self.canvas2:
        if self.arrow2:
            canvas.delete(self.arrow2)
        self.arrow2 = canvas.create_line(center_x, center_y, end_x, end_y, arrow=tk.LAST, fill='goldenrod', width=6)

        # Add the numbers to the outer circle
        outer_radius = inner_radius + 20
        for i in [0, -135, 90, -45, 0, 45, 90, 135, 178]:
            angle_rad = math.radians(-i)
            num_x = center_x + outer_radius * math.cos(angle_rad)
            num_y = center_y + outer_radius * math.sin(angle_rad)
            canvas.create_text(num_x, num_y, text=str(i), fill='black')`

     

New contributor

Moysés Requiao is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật