Adding A Button Bar

Now, we will add in the button widgets to our left frame. In this example, we are only going to be making three different colors to work with, but you can expand this to more colors later.

First, make some new widgets representing the colors to select from. Note that each of these is identical, with only the attribute “bg” being changed between buttons. Recall that “leftFrame” is where we want to place the widget inside of the app.

red = Button(leftFrame, bg = "red", width = 6, height = 2)
green = Button(leftFrame, bg = "green", width = 6, height = 2)
blue = Button(leftFrame, bg = "blue", width = 6, height = 2)

Now we want to pack these buttons into place with the “pack” function

red.pack()
green.pack()
blue.pack()