Advertisement
famansour

IHM V0

Jun 15th, 2020
1,182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.08 KB | None | 0 0
  1. import tkinter as tk
  2. import time
  3.  
  4. class Application(tk.Frame):
  5.     def __init__(self, master=None):
  6.         super().__init__(master)
  7.         self.master = master
  8.         self.pack()
  9.         self.create_widgets()
  10.  
  11.     def create_widgets(self):
  12.         self.hi_there = tk.Button(self)
  13.         self.hi_there["text"] = "Hello World\n(click me)"
  14.         self.hi_there["command"] = self.say_hi
  15.         self.hi_there.pack(side="top")
  16.  
  17.         self.quit = tk.Button(self, text="QUIT", fg="red",
  18.                               command=self.master.destroy)
  19.         self.quit.pack(side="bottom")
  20.  
  21.         self.hi_there2 = tk.Button(self)
  22.         self.hi_there2["text"] = "GetTime"
  23.         self.hi_there2["command"] = self.get_time
  24.         self.hi_there2.pack(side="top")
  25.  
  26.     def say_hi(self):
  27.         print("hi there, everyone!")
  28.     def get_time(self):
  29.         t = time.time()
  30.         return t
  31.  
  32. root = tk.Tk()
  33. app = Application(master=root)
  34. app.mainloop()
  35.  
  36. #
  37. #    def get_time(self):
  38. #        t0 = time.time()
  39. #
  40. #
  41. #
  42. #t0 = time.time()
  43. #
  44. #t1 = time.time()
  45. #
  46. #total = t1-t0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement