From the course: Python GUI Development with Tkinter

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Binding to events

Binding to events

From the course: Python GUI Development with Tkinter

Start my 1-month free trial

Binding to events

- [Instructor] Now that the widgets are all in place it's time to make the survey form actually do something useful. If you remember back to the initial requirements, when the submit button is pressed it'll need to do three things. It'll print the contents of the input field to the console output. It will clear the current contents of the input fields. And, it will notify the user that their comments were successfully submitted. When the clear button is pressed it'll just erase the contents from the entry and text widgets. To accomplish these tasks I'm going to define a command callback method for each of the buttons that will be executed when they're pressed. I'm going to begin by creating two methods inside of the feedback class. I'll create them after my init method. I'll call one method submit, and since it's inside of a class it needs to take a parameter of self. I'll call the other method clear. I'm going to fill out the clear method first. To erase the contents of the entry and…

Contents