完全用python做一个带有窗口的应用软件,可以吗
发布网友
发布时间:2022-03-24 02:18
我来回答
共2个回答
热心网友
时间:2022-03-24 03:47
可以的啊,官方帮助文档里面就有说明和示例的啊。
贴一下Helloworld代码:
import tkinter as tk
class Application(tk.Frame):
def __init__(self, master=None):
tk.Frame.__init__(self, master)
self.pack()
self.createWidgets()
def createWidgets(self):
self.hi_there = tk.Button(self)
self.hi_there["text"] = "Hello World\n(click me)"
self.hi_there["command"] = self.say_hi
self.hi_there.pack(side="top")
self.QUIT = tk.Button(self, text="QUIT", fg="red",
command=root.destroy)
self.QUIT.pack(side="bottom")
def say_hi(self):
print("hi there, everyone!")
root = tk.Tk()
app = Application(master=root)
app.mainloop()
热心网友
时间:2022-03-24 05:05
当然可以了啊