#劉任昌教python設窗程式設計 from tkinter import * #從函式庫 tkinter 輸入所有 * 方法 from math import * #從函式庫 math 輸入所有 * 方法 class Regular: #定義類別Regular正多邊形或星型 def __init__(self, cx, cy, cr, s, t, c, w): #類別共同的設定 self.cx, self.cy, self.cr = cx, cy, cr #取得中心座標cx, cy, 半徑cr self.s, self.t = s, t #取得邊角數目s,t尖銳程度,取代原來的k = s.get() self.c, self.w = c, w #取得顏色c,寬度w self.u = 2 * pi / self.s #使用模組 math 圓周率 pi self.x, self.y = [], [] for i in range( int(self.s * 1.5)): self.x.append(self.cx + self.cr*cos(i*self.u)) self.y.append(self.cy + self.cr*sin(i*self.u)) def draw(self): #類別的方法 for i in range( int(self.s * 1.5) - self.t): canvas.create_line(self.x[i], self.y[i], self.x[i + self.t], self.y[i + self.t], fill = self.c, width = self.w) def show(): #畫圖 poly = Regular(cx.get(), cy.get(), cr.get(), s.get(), t.get(), c.get(), w.get()) ...
D11017153 王芷榆
回覆刪除https://wangjhihyu0207.blogspot.com/2024/06/blog-post.html
D11017237 張博宇 https://gold-1-2zhang842.blogspot.com/2024/06/6-16-2024.html
回覆刪除D11017108李嘉芊
回覆刪除https://jia-0909.blogspot.com/2024/06/blog-post.html
D11017121江舜廷
回覆刪除https://ting1008finan.blogspot.com/2024/06/blog-post.html
D11050131鄭智元
回覆刪除https://ryu2022.blogspot.com/2024/06/blog-post.html
d11017353謝貴子
回覆刪除https://d11017353.blogspot.com/2024/06/blog-post.html
D11017125江宥蓉
回覆刪除https://takingfinance.blogspot.com/2024/06/blog-post.html
D11017202吳睿捷https://draft.blogger.com/blog/post/edit/preview/6174802439427569065/6437264383436573002
回覆刪除D11017311陳佑愷
回覆刪除https://danley1116.blogspot.com/2024/06/blog-post.html
D11017157 陳名君
回覆刪除https://takming12345.blogspot.com/2024/06/blog-post.html
D11017257蔡欣辰
回覆刪除https://takming123.blogspot.com/2024/06/blog-post.html
D11017218李美靚
回覆刪除https://d11017218.blogspot.com/2024/06/blog-post.html
D11017352 張弘陽
回覆刪除https://35607161.blogspot.com/2024/06/blog-post.html