#黃姵妮
from tkinter import * #從函式庫 tkinter 輸入所有 * 方法
from math import * #從函式庫 math 輸入所有 * 方法
t = (3,4,5,6,7,8,9,10,11,12,16,20) #宣告一元組tuple(...)
tk = Tk()
tk.title("黃姵妮視窗使用者介面GUI")
canvas = Canvas(tk, width=500, height=500)
canvas.pack()
def show(event): #定義由事件event(按鈕選單)呼叫的函數show
cx, cy, cr = 210, 210, 200 #宣告圓中心座標cx, cy半徑cr
x, y =[],[] #宣告二陣列[...]
k = s.get() #取得 ge t按鈕選單的選擇變數
u = 2 * pi / k #使用模組 math 圓周率 pi
for i in range(k):
x.append(cx + cr*cos(i*u)) #加入陣列的元素
y.append(cy + cr*sin(i*u)) #使用模組 math 三角函數cos, sin
for i in range(k-1):
canvas.create_line(x[i], y[i], x[i+1], y[i+1])
canvas.create_line(x[k-1], y[k-1], x[0], y[0]) #可考慮增加width寬度,fill顏色
def diagonal():
cx, cy, cr = 210, 210, 200 #宣告圓中心座標cx, cy半徑cr外來學繼承 inheritance
x, y =[],[] #宣告二陣列[...]
k = s.get() #取得 ge t按鈕選單的選擇變數
u = 2 * pi / k #模組 math 圓周率 pi
for i in range(k):
x.append(cx + cr*cos(i*u)) #加入陣列的元素
y.append(cy + cr*sin(i*u))
for i in range(k):
for j in range(i+2, k):
canvas.create_line(x[i], y[i], x[j], y[j], fill="green", width=3)
s = IntVar(tk)
combo = OptionMenu(tk, s, *t, command = show).pack() #下拉式按鈕combobox
button = Button(tk, text="對角線", command = diagonal).pack()#按鈕button
tk.mainloop()
黃姵妮利用w3schools學習HTML,CSS,Borders 德 明 黃 姵 妮 Html上的物件,稱為元素body, p=paragraph, div=division 教學影片138 w3schools截圖 使用專業程式碼編輯器IDE整合開發環境 JAVA變數 String-字串- text, such as "Hello". String values are surrounded by double quotes int-整數 - integers (whole numbers), without decimals, such as 123 or -123 float-浮點數,實數- floating point numbers, with decimals, such as 19.99 or -19.99 char-字元 -single characters, such as 'a' or 'B'. Char values are surrounded by single quotes boolean-邏輯 - stores values with two states: true or false IEEE=Institute of Electric and Electronic Engineering JAVA
黃姵妮利用專業的整合開發環境R Studio 常用的IDE整合開發環境有: Microsoft發展的Visual Studio Code R Sudio Atom Eclipse IntelliJ JCreator 黃姵妮整理IDE使用率排行stckoverflow Visual Studio Code74.48% Visual Studio32.15% IntelliJ 27.97% Notepad++ 27.71% Vim 23.34% Android Studio 19.8% PyCharm 17.24% Sublime Text 16.59% Eclipse 12.57% IPython/Jupyter 11.61% Xcode 10.53% Atom 9.35% 表單輸入數字與呼叫JavaScript 輸入數字 輸入名字 輸出結果 黃姵妮RStudio編輯表單input button text number輸出innerHTML VS Code編輯HTML/CSS/JavaScript
423 python GUI.
回覆刪除326 tuple, set, list.