發表文章

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

朱冠宇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 ()