2019年2月26日 星期二

程式

# flag02
# 畫中德國國旗
# 導入 doc
from browser import document as doc
from browser import html
import math
canvas = html.CANVAS(width = 300, height = 200)
canvas.style = {"width": "100%"}
canvas.id = "taiwan_flag"
brython_div = doc["brython_div"]
brython_div <= canvas

# 準備繪圖畫布
canvas = doc["flag02"]
ctx = canvas.getContext("2d")
# 進行座標轉換, x 軸不變, y 軸反向且移動 canvas.height 單位光點
# ctx.setTransform(1, 0, 0, -1, 0, canvas.height)
# 以下採用 canvas 原始座標繪圖
flag_w = canvas.width
flag_h = canvas.height
circle_x = flag_w/4
circle_y = flag_h/4
# 先畫滿地紅
ctx.fillStyle='rgb(255, 0, 0)'
ctx.fillRect(0,0,flag_w,flag_h)
# 先畫滿地黑
ctx.fillStyle='rgb(0, 0, 0)'
ctx.fillRect(0,0,flag_w,flag_h/3)
# 先畫滿地黃
ctx.fillStyle='rgb(255, 255, 0)'
ctx.fillRect(0,135,flag_w,flag_h/3)

2019年2月25日 星期一

心得

心得:

虎尾是個好地方,交通不便,每到連假時,就會變成空城,你能在這體驗很多三寶阿罵阿公,讓你每天必須提起精神騎車,之後你上課才會有精神,每次為了一餐有很多煩惱,到最後還不識吃那幾家。

程式

# flag02 # 畫中德國國旗 # 導入 doc from browser import document as doc from browser import html import math canvas = html.CANVAS(width = 300, heigh...