發表文章

目前顯示的是 4月, 2024的文章

李曜宇Python建立GUI圖形使用者介面

圖片
from tkinter import * #從函式庫 tkinter 輸入所有 * 方法 from math import * #從函式庫 math 輸入所有 * 方法 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 * 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(): #畫圖 define自訂函數 poly = Regular(cx.get(), cy.get(), cr.get(), s.get(), t.get(), c.get(), w.get()) pol...

李曜宇期中考EMOJI取代斜線SLASH反斜線BACKSLASH

李曜宇輸入參數 輸入k 輸入m 輸入n 執行自訂函數 purple gray blue python自訂函數 def money(x,y): return x*y js自訂函數 function money(x,y){ return x*y;} 重點 span手掌張開拇指到小指,短橋梁長度。 VSCode是IDE整合開發環境。 CTRL+SHIFT+L一次改全部 Integrated Development Environment alert內建函數,自訂函數abc 利用id加上syle方法是#id 李曜宇輸出結果

李曜宇python期中考javascript按鈕botton事件onchange

圖片
CSS示範程式碼 h1{background-color: purple; color: white; border: 10px solid red; text-align:center; padding: 5px} ul{background-color: green; color: white; font-size: 2em;line-height:1.5} input{font-size:24px;background-color:rgb(210, 250, 215);} .monkey{font-size:36px;} HTML示範程式碼 劉任昌輸入參數 輸入k 輸入m 輸入n 執行自訂函數 重點 alert內建函數,自訂函數abc 劉任昌輸出結果 JAVASCRIPT示範程式碼 const space=' ', slash='/', backslash='\\', cr='\n'; function row1(k,m){ for(let i=0; i \n'; for(let i=0; i '; document.getElementById('out').innerHTML=out;}