0

I am trying code a single button that will fire two commands, that is, it will open two image files with one button selection.

I have researched this and have not found much directly related to this question; what I found was to use a def within a def, thus binding both to this one button. I do not quite understand this. I tried a quick idea originally of adding a second command with a comma (,) following the first command:

btn1 = Button(root, text="Play", command=show_image2, command=show_image3)

I thought this could work but it only gave an error when ran.

I am simply trying to bind two (2) commands to a single button so when it is selected by a user two images open together on the canvas.

**Note: I am not seeking help with the actual rendering of images to the screen (GUI), only help with the button commands.

Any push in the right direction or any suggestions will be greatly appreciated.

Regards,
sharky_machine

3
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by Mouche
0

I'm confused. Couldn't you do this:

btn1 = Button(root, text="Play", command=show_images)

and then

def show_images():
    show_image2()
    show_image3()

Jeff

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.