123

import tkinter as tk #輸入函式庫改稱tk from tkinter import messagebox root = tk.Tk() root.title('邱季萱建構視窗') root.geometry('600x300+400+100') def showinfo(): messagebox.showinfo('我超美showinfo', 'showinfo') btn_showinfo = tk.Button(root, text='showinfo', command=showinfo) btn_showinfo.pack() def showwarning(): messagebox.showwarning('showwarning', 'showwarning') btn_showwarning = tk.Button(root, text='showwarning', command=showwarning) btn_showwarning.pack() def showerror(): messagebox.showerror('showerror顯示錯誤', 'showerror') btn_showerror = tk.Button(root, text='showerror', command=showerror) btn_showerror.pack() def askquestion(): messagebox.askquestion('askquestion', 'askquestion') btn_askquestion = tk.Button(root, text='askquestion', command=askquestion) btn_askquestion.pack() def askyesno(): messagebox.askyesno('askyesno', 'askyesno') btn_askyesno = tk.Button(root, text='askyesno', command=askyesno) btn_askyesno.pack() def askokcancel(): messagebox.askokcancel('askokcancel', 'askokcancel') btn_askokcancel = tk.Button(root, text='askokcancel', command=askokcancel) btn_askokcancel.pack() def askretrycancel(): messagebox.askretrycancel('你是豬八戒', '你是豬八戒') btn_askretrycancel = tk.Button(root, text='你是豬八戒', command=askretrycancel) btn_askretrycancel.pack() label = tk.Label(root, text='邱季萱', font=('標楷體',40)) label.pack() root.mainloop()

留言

  1. 期末考的<Left>首個字母要大寫!https://qiujixuan.blogspot.com/2026/01/python.html
    curly brackets. https://qiujixuan.blogspot.com/2025/12/python_28.html
    sin cos. https://qiujixuan.blogspot.com/2025/12/blog-post.html
    https://qiujixuan.blogspot.com/2025/12/python.html
    https://qiujixuan.blogspot.com/2025/12/pythonglobalif.html
    https://qiujixuan.blogspot.com/2025/11/pythontkintermath.html
    https://qiujixuan.blogspot.com/2025/11/123.html

    回覆刪除

張貼留言

這個網誌中的熱門文章

邱季萱python全域變數global和判斷if

邱季萱python輸入tkinter和math函式庫