Skip to content

Instantly share code, notes, and snippets.

@vahit
Created July 13, 2014 14:06
Show Gist options
  • Save vahit/e5145d853a05d6da5cc3 to your computer and use it in GitHub Desktop.
Save vahit/e5145d853a05d6da5cc3 to your computer and use it in GitHub Desktop.
master
#!/usr/sbin/env python
from tkinter import *
class Application(Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.grid()
self.create_widgets()
self.count_value = 0
def create_widgets(self):
self.count_label = Label(self, text="Count: 0")
self.count_label.grid(row=0, column=1)
self.incr_button = Button(self, text="Increment", command=self.increment_count)
self.incr_button.grid(row=0, column=0)
self.quit_button = Button(self, text="Quit", command=self.master.destroy)
self.quit_button.grid(row=1, column=0)
def increment_count(self):
self.count_value += 1
self.count_label.configure(text='Count: ' + str(self.count_value))
app = Application()
app.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment