發表文章

朱冠宇eval=evaluate函數calculator美國男生印度女生.調色板

圖片
w3schools eval() 美國男生bro code from tkinter import * def button_press(num): global equation_text equation_text = equation_text + str(num) equation_label.set(equation_text) def equals(): global equation_text try: total = str(eval(equation_text)) equation_label.set(total) equation_text = total except SyntaxError: equation_label.set("syntax error") equation_text = "" except ZeroDivisionError: equation_label.set("arithmetic error") equation_text = "" def clear(): global equation_text equation_label.set("") equation_text = "" window = Tk() window.title("劉任昌計算機calculator") window.geometry("500x500") equation_text = "" equation_label = StringVar() label = Label(window, textvariable=equation_label, font=('consolas',20), bg="white", width=24, height=2) label.pack() frame = Frame(w...

朱冠宇tkinter繪圖套件time時間sleep方法

圖片
程式碼 from tkinter import * #下載程式碼,從tkinter輸入所有函式 import time x = [ ' \U0001F600 ' , ' \U0001F601 ' , ' \U0001F602 ' , ' \U0001F615 ' , ' \U0001F622 ' ] #定義一個串列 y = [] #追蹤特定視窗用途,尚未使用 for i in range ( 5 ):     window = Tk () #建構視窗,名為window建構一個房子     window . title ( '朱冠宇python第 %d 視窗' % ( i + 1 ))     window . geometry ( '400x400+ %d +100' % ( 400 * i ))     b1 = Label ( window , text = x [ i ], font = 'Arial 250 bold' ). pack ()     time . sleep ( 1 )     window . update ()     y . append ( window ) #追蹤特定視窗用途,尚未使用 window . mainloop ()

朱冠宇python期中考javascript按鈕button事件onchange

圖片
js程式碼 const space = ' ' , slash = '/' , backslash = ' \\ ' , cr = ' \n ' ; function row1 ( k , m ){     for ( let i = 0 ; i < k ; i ++ ){         for ( let ii = 0 ; ii < m ; ii ++ ){             for ( let j = 0 ; j < k - i - 1 ; j ++ )                 out += space ;             out += slash ;             for ( let j = 0 ; j < 2 * i ; j ++ )                 out += space ;             out += backslash ;             for ( let j = 0 ; j < k - i - 1 ; j ++ )                 out += space ;};     out += cr ;};}; function row2 ( k , m ){     for ( let i = 0 ; i < k ; i ++ ){         for ( let ii = 0 ; ii < m ; ii ++ ){  ...

朱冠宇Python與javascript程式碼對照

圖片
朱冠宇輸入參數 輸入k 輸入m 輸入n 執行自訂函數 重點 alert內建函數,自訂函數abc 朱冠宇輸出結果

朱冠宇Python自訂函數迴圈write模式a與w

圖片
上面的程式碼 <style>   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} </style> VS code截圖 程式碼 a space, slash, backslash, cr = ' ', '/', '\\', '\n' def row1(k,m):#定義自訂函數 for i in range(1, k+1): for ii in range(m): for j in range(k-i): f.write(space) f.write(slash) for j in range(2*i-2): f.write(space) f.write(backslash) for j in range(k-i): f.write(space) f.write(cr) def row2(r,m): for i in range(1, k+1): for ii in range(m): for j in range(i-1): f.write(space) f.write(backslash) for j in range(2*k-2*i): f.write(space) f.write(slash) for j in range(i-1): f.write(space)...

朱冠宇python寫入write迴圈範圍range

圖片
space, slash, backslash, cr = ' ', '/', '\\', '\n' k = input('邊長: ') #輸入字串 m = input('橫向: ') k, m = int(k), int(m) f = open("難嗎.txt",'w',encoding='utf8') f.write('劉任昌讀取檔案' + cr)#註解\n換列 for i in range(9): f.write(str(i)) f.write(cr) for i in range(1, k+1): #迴圈1到k for ii in range(m): for j in range(k-i): f.write(space) f.write(slash) for j in range(2*i-2): f.write(space) f.write(backslash) for j in range(k-i): f.write(space) f.write(cr) for i in range(1, k+1): for ii in range(m): for j in range(i-1): f.write(space) f.write(backslash) for j in range(2*k-2*i): f.write(space) f.write(slash) for j in range(i-1): f.write(space) f.write(cr) f.close()

朱冠宇HTML_CSS_Javascnipt_Java_python

圖片
import java.awt.*; import java.awt.geom.Line2D; import javax.swing.*; public class Options { public static void main(String[] args) { JFrame frame = new JFrame("朱冠宇Java繪製選擇權到期日損益"); Container cp = frame.getContentPane(); cp.add(new JComponent() { public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setStroke(new BasicStroke(5));//stroke中風,筆觸 g2.setFont(new Font("monospaced", Font.BOLD, 16)); g2.drawString("買入賣權到期日損益",0,120); g2.draw(new Line2D.Float(0, 0, 100, 100)); g2.draw(new Line2D.Float(100, 100, 200, 100)); g2.drawString("買入買權到期日損益",300,120); g2.draw(new Line2D.Float(300, 100, 400, 100)); g2.draw(new Line2D.Float(400, 100, 500, 0)); g2.drawString("賣出賣權到期日損益",0,180); g2.draw(new Line2D...