| | |
One Button: Multiple Commands
Thread Solved |
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:
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
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: ++
•
•
Join Date: Jul 2006
Posts: 608
Reputation:
Solved Threads: 150
I'm confused. Couldn't you do this:
and then
Jeff
Python Syntax (Toggle Plain Text)
btn1 = Button(root, text="Play", command=show_images)
and then
Python Syntax (Toggle Plain Text)
def show_images(): show_image2() show_image3()
Jeff
![]() |
Similar Threads
- Send at commands to device on comport (Visual Basic 4 / 5 / 6)
- How to print to file (Perl)
- Implementing a unix shell running commands (Java)
- Tkinter Button(s) (Python)
Other Threads in the Python Forum
- Previous Thread: Monitoring number of smtp bytes sent through python e-mail socket
- Next Thread: Tkinter user-input
| Thread Tools | Search this Thread |
address alarm anydbm app beginner cipher conversion coordinates curves cx-freeze data development dictionary directory dynamic examples excel feet file float format function generator getvalue gui halp handling homework images import input ip itunes java keycontrol line linux list lists loan loop maintain maze millimeter mouse mysqldb number numbers output parsing path port prime programming projects py2exe pygame pyglet pymailer python queue random recursion recursive screensaverloopinactive script scrolledtext searchingfile shebang slicenotation split ssh string strings table terminal text thread threading time tlapse tooltip tuple tutorial type ubuntu unicode url urllib urllib2 variable variables ventrilo verify vigenere web webservice wx.wizard wxpython xlwt






