To change button state of a Tkinter button?
<p>How to make a <strong>tkinter program</strong> the button of which remains pressed when clicked once and takes input continuosly untill it is clicked again when it returns to its original state and the output is no more taken? <em>(as if like the work of record button)</em></p>

<p>You can control the button's appearance by configuring its <code>relief</code> option.</p>

<pre><code>try:
    import Tkinter as tk
except ImportError:
    import tkinter as tk

class Application(tk.Frame):
    def __init__(self, master=None):
        tk.Frame.__init__(self, master)
        self.grid()
        self.createWidgets()

    def createWidgets(self):
        self.recording = False
        self.recButton = tk.Button(self, text='Record', command=self.clicked,
                                   relief=tk.SUNKEN)
        self.recButton.grid()
        self.quitButton = tk.Button(self, text='Quit', command=self.quit)
        self.quitButton.grid()

    def clicked(self):
        self.recording = not self.recording
        if self.recording:
            self.recButton.config(relief=tk.RAISED)
        else:
            self.recButton.config(relief=tk.SUNKEN)

app = Application()
app.master.title('Stateful Button')
app.mainloop()
</code></pre>

python tkinter