Interfaz simple de ventana con 2 botones


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. from Tkinter import *
  2.  
  3. class App:
  4. def __init__(self,master):
  5.  
  6. frame = Frame(master)
  7. frame.pack()
  8.  
  9. self.button = Button(frame,text = "QUIT",fg = "red", command=frame.quit)
  10. self.button.pack(side=LEFT)
  11.  
  12. self.hi_there = Button(frame,text="Hello",command=self.say_hi)
  13. self.hi_there.pack(side=LEFT)
  14.  
  15. def say_hi(self):
  16. print("hi there, everyone!")
  17.  
  18. root = Tk()
  19.  
  20. app = App(root)
  21.  
  22. root.mainloop()

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.