GUI界面------tkinter

import tkinter as tk

class APP:
    def __init__(self,master):
        frame = tk.Frame(master)
        frame.pack(side = tk.LEFT,padx=50,pady=50)

        self.hi_there = tk.Button(frame,text ="打招呼",bg = "blue",fg = "white",command = self.say_hi)
        self.hi_there.pack()

    def say_hi(self):
        print("Hello World!")

root = tk.Tk()
app = APP(root)

root.mainloop()
原文地址:https://www.cnblogs.com/chenyang920/p/4906692.html