One Button: Multiple Commands

Thread Solved

Join Date: Oct 2006
Posts: 2,564
Reputation: mattyd is an unknown quantity at this point 
Solved Threads: 1
Featured Poster
mattyd's Avatar
mattyd mattyd is offline Offline
Posting Maven

One Button: Multiple Commands

 
0
  #1
Nov 29th, 2006
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
Last edited by mattyd; Nov 29th, 2006 at 7:23 pm. Reason: ++
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 608
Reputation: jrcagle is on a distinguished road 
Solved Threads: 150
jrcagle jrcagle is offline Offline
Practically a Master Poster

Re: One Button: Multiple Commands

 
0
  #2
Nov 29th, 2006
I'm confused. Couldn't you do this:

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

and then

  1. def show_images():
  2. show_image2()
  3. show_image3()

Jeff
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 128
Reputation: LaMouche is on a distinguished road 
Solved Threads: 19
LaMouche's Avatar
LaMouche LaMouche is offline Offline
Junior Poster

Re: One Button: Multiple Commands

 
0
  #3
Dec 5th, 2006
That seems like the obvious solution.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC