hello.py 536 B

12345678910111213141516171819202122232425
  1. #!/usr/bin/env python3
  2. from tkinter import *
  3. class Window(Frame) :
  4. def __init__(self, master=None) :
  5. Frame.__init__(self, master)
  6. self.master = master
  7. self.init_window()
  8. def init_window(self) :
  9. self.master.title("GUI")
  10. self.pack(fill=BOTH, expand=1)
  11. quitButton = Button(self, text="Hello", command=self.hello)
  12. quitButton.place(x=100, y=100)
  13. def hello(self):
  14. print("Hello, World!")
  15. root = Tk()
  16. root.geometry("400x300")
  17. app = Window(root)
  18. root.mainloop()