Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- import time
- class Application(tk.Frame):
- def __init__(self, master=None):
- super().__init__(master)
- self.master = master
- self.pack()
- self.create_widgets()
- def create_widgets(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=self.master.destroy)
- self.quit.pack(side="bottom")
- self.hi_there2 = tk.Button(self)
- self.hi_there2["text"] = "GetTime"
- self.hi_there2["command"] = self.get_time
- self.hi_there2.pack(side="top")
- def say_hi(self):
- print("hi there, everyone!")
- def get_time(self):
- t = time.time()
- return t
- root = tk.Tk()
- app = Application(master=root)
- app.mainloop()
- #
- # def get_time(self):
- # t0 = time.time()
- #
- #
- #
- #t0 = time.time()
- #
- #t1 = time.time()
- #
- #total = t1-t0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement