O'Reilly logo

Python GUI Programming with Tkinter by Alan D. Moore

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding LabelFrame and other widgets

Our form is divided into sections with a label for and a box around each section. For each section, we'll create a LabelFrame widget and start adding our LabelInput widgets to it by performing the following steps:

  1. Let's start with the record information frame by executing the following code:
        recordinfo = tk.LabelFrame(self, text="Record Information")
Remember that the text argument to LabelFrame defines the text of the label. This widget will be passed as the parent widget to all the inputs in the record information group.
  1. Now, we'll add the first line of the input widgets, as follows:
 self.inputs['Date'] = LabelInput(recordinfo, "Date", input_var=tk.StringVar()) self.inputs['Date'].grid(row=0, column=0) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required