|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- import tkinter as tk
- import sys
- import os
- import time
- class App:
- def __init__(self, root):
- frame = tk.Frame(root)
- frame.pack()
- self.Calc = tk.Button(frame, text="计算器", fg="blue", command=self.calc)
- self.Calc.pack(side=tk.LEFT)
- self.Notepad = tk.Button(frame, text="记事本", fg="black", command=self.notepad)
- self.Notepad.pack(side=tk.LEFT)
- self.Time = tk.Button(frame, text="时间", fg="red", command=self.time).pack()
- self.Time.pack(side=tk.LEFT)
- def calc(self):
- os.system("calc")
-
- def notepad(self):
- os.system("notepad")
- def time(self):
- top = Toplevel()
- top.title("时间")
- msg = Message(top, text="现在是:" + time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time()))
- msg.pack()
复制代码
运行后为什么会报错??? |
|