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.
Capturing input with buttons
From the course: Python GUI Development with Tkinter
Capturing input with buttons
- [Instructor] Unlike labels, which merely display information, buttons are designed specifically for the user to interact with. They're one of the simplest ways for a user to provide input to your program. When the user clicks on a button, they expect something to happen. That means, in addition to defining the look and feel of a button, our program will also need to define the action it will perform when pressed. I'll begin by importing the tkinter package by calling from tkinter import asterisk. And I'll also import the themed ttk module from tkinter import ttk. After that, I'll call the tk constructor method to create my top level route window. And now, I'm ready to begin creating buttons. I'll create a button by calling the themed ttk button constructor method, and notice, button is spelled with a capital B. I'll pass in it's parent, which is the first parameter, as always. And then, I'll also configure the property for the button called text. And I'm going to make this button…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Displaying text and images with labels9m 18s
-
(Locked)
Capturing input with buttons6m 45s
-
(Locked)
Presenting choices with check buttons and radio buttons7m 15s
-
(Locked)
Entering single-line text with the Entry widget4m 53s
-
(Locked)
Making selections with the Combobox and Spinbox5m 38s
-
(Locked)
Inputting values and displaying status with the Scale and Progressbar7m 34s
-
(Locked)
-
-
-
-
-
-