發表文章

傅彥綦(補作業)python tkinter

圖片
from tkinter import * #從函式庫 tkinter 輸入所有 * 方法 import math #從函式庫 math 輸入所有 * 方法 from time import * from random import * class Regular: def __init__(self, cx, cy, cr, s, t, c, w): #類別共同的設定必然 def __init__ initiate發起 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 * math.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*math.cos(i*self.u)) self.y.append(self.cy + self.cr*math.sin(i*self.u)) def drawLine(self, x0, y0, x1, y1): canvas.create_line(x0, y0, x1, y1, width = self.w, fill=self.c) def draw(self): #類別的方法 secondTime = second.get() #取得輸入的second變數,當作區域變數secondTime for i in range( int(self.s * 1.5) - self.t): self.drawLine(self.x[i], ...

傅彥綦類別,必須有 兩底線init兩底線的起始initiate函數

圖片
class Person: #建立類別,必須有 兩底線init兩底線的起始initiate函數 def __init__(self, name, age): self.name = name self.age = age def myfunc(self): print("靠!我的") print("名字是" + self.name) print("靠!我的\n名字是" + self.name) #字串中\n換列 p1 = Person("傅彥綦", 36) p1.myfunc() print("印出p1.name: " + p1.name) from tkinter import * #從函式庫 tkinter 輸入所有 * 方法 import math #從函式庫 math 輸入所有 * 方法 from time import * from random import * class Regular: def __init__(self, cx, cy, cr, s, t, c, w): #類別共同的設定必然 def __init__ initiate發起 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 * math.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*math.cos(i*self.u)) self.y.append(self.cy + self.cr*m...

傅彥綦w3school補考Java

圖片
w3schools學習Java程式碼 Java程式碼 public class Main { /*傅彥綦2023.1.12上午w3school學java字串處理*/ public static void main(String[] args) { String a = "狗吃屎 貓抓鼠";/*宣告字串型態a預設"自己打"*/ String b = ""; /*宣告字串型態b預設""*/ System.out.println("原來的字串: " + a); for (int i = 0; i

傅彥綦s陣列array宣告

圖片
w3schools陣列array宣告:型態[ ]方括號corner brackets //傅彥綦,2022/1/10,學習陣列,方法length public class Main { public static void main(String[] args) { String[] cars = {"富豪","寶馬","福特","馬自達","撈屎來食"}; int j; /* 宣告位元數 j */ j = cars.length; /* 給定 j = 陣列 cars.長度 */ System.out.println("陣列長度:"+ j );/* 方法印出來print */ for (int i = 0; i 截圖w3schools型態[ ]方括號corner brackets 取得連結 Facebook Twitter Pinterest 以電子郵件傳送 其他應用程式 留言 陳俊宇程式設計 2022年11月9日 下午5:39 https://spencer0309.blogspot.com/2022/11/javaarray.html 回覆 刪除 回覆 回覆 吳泊諺 2022年11月9日 下午5:40 https://alien1213.blogspot.com/2022/11/javaarray.html 回覆 刪除 回覆 回覆 陳姵蓁 2022年11月9日 下午5:41 https://cpc920508123.blogspot.com/2022/11/htmlcssjavascriptjava.html 回覆 刪除 回覆 回覆 李建東 2022年11月9日 下午5:41 https://www.blogger.com/blog/post/edit/4784021696047026617/6664437845995953721...