Skip to content

Instantly share code, notes, and snippets.

/__main__.py Secret

Created May 27, 2017 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7ab9d5acf61f6de5452236abc47f42dd to your computer and use it in GitHub Desktop.
Save anonymous/7ab9d5acf61f6de5452236abc47f42dd to your computer and use it in GitHub Desktop.
from tkinter import *
class Application(Frame):
def say_hi(self):
print("hi there, everyone!")
def createWidgets(self):
self.QUIT = Button(self)
self.QUIT["text"] = "QUIT"
self.QUIT["fg"] = "red"
self.QUIT["command"] = self.quit
self.QUIT.pack({"side": "left"})
self.hi_there = Button(self)
self.hi_there["text"] = "Hello",
self.hi_there["command"] = self.say_hi
self.hi_there.pack({"side": "left"})
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.createWidgets()
def main():
root = Tk()
app = Application(master=root)
app.mainloop()
root.destroy()
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment