python 使用python tinker创建GUI

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 使用python tinker创建GUI相关的知识,希望对你有一定的参考价值。

from tkinter import *

class Window(Frame):

    def __init__(self, master = None):
        Frame.__init__(self, master)
        self.master = master

        self.init_window()
    
    #init the with button
    def init_window(self):
        self.master.title("GUI")
        self.pack(fill=BOTH, expand=1)
        quitButton = Button(self, text = "Complete")
        quitButton.place(x = 10, y = 10)
    

root = Tk()
root.geometry("400x300")
app = Window(root)
root.mainloop()

以上是关于python 使用python tinker创建GUI的主要内容,如果未能解决你的问题,请参考以下文章