發表文章

目前顯示的是 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 = Fra...

張心妮tkinter繪圖套件time時間sleep方法

圖片
from tkinter import * #下載程式碼,從tkinter輸入所有函式 import time x=['\U0001F600','\U0001F609','\U0001F642','\U0001F615','\U0001F617'] for i in range(5): window = Tk() #建構視窗,名為window建構一個房子 window.title('張心妮第%d個視窗' % i) window.geometry('300x300+%d+0' % (300*i)) b1=Label(window,text=x[i],font='Arial 250 bold').pack() time.sleep(1) window.update() window.mainloop()

張心妮tkinter套件建立圖形使用者介面GUI=Graphical User Interface

圖片
from tkinter import * #下載程式碼,從tkinter輸入所有函式 window = Tk() #建構視窗,名為window建構一個房子 window.title('張心妮的python視窗') window.geometry('600x600+100+100') b1=Label(window,text='\U0001F600',font='Arial 300 bold').pack() window1 = Tk() #建構視窗,名為window建構另一個windows window1.title('張心妮的python視窗') window1.geometry('600x600+800+100')#寬x高 b1=Label(window1,text='\U0001F610',font='Arial 300 bold').pack() window.mainloop()