Adding widgets to a parent window

The format used to add widgets is the same as the one that we discussed in the previous task. To give you an idea about how it's done, here's some sample code that adds some common widgets:

Label(parent, text="Enter your Password:")Button(parent, text="Search")Checkbutton(parent, text="Remember Me", variable=v, value=True)Entry(parent, width=30)Radiobutton(parent, text="Male", variable=v, value=1)Radiobutton(parent, text="Female", variable=v, value=2)OptionMenu(parent, var, "Select Country", "USA", "UK", "India","Others")Scrollbar(parent, orient=VERTICAL, command= text.yview)

Can you spot the pattern that is common to each widget? Can you spot the differences?

As a reminder, the syntax for adding a widget ...

Get Tkinter GUI Application Development Blueprints - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.