Browse | Submit A New Snippet | Create A Package

 

hello_buttons

Type:
Full Script
Category:
Other
License:
GNU General Public License
Language:
Python
 
Description:
Create programmable Buttons with TKInter

Versions Of This Snippet::

peter bauer
Snippet ID Download Version Date Posted Author Delete
6641.02012-09-02 16:34peter bauer

Download a raw-text version of this code by clicking on "Download Version"

 


Latest Snippet Version: :1.0

#!/usr/bin/python
# peter bauer
# peba@inode.at

import subprocess
from Tkinter import *
import os

def run(param):
   param = param + "&"
   retcode = os.system (param)
   
root = Tk()
root.title('Buttons')
root.resizable(width=FALSE, height=FALSE)

commands=["xterm","xclock","gedit"]

index=0
while index  <= len(commands)-1:
  Button(root, text=commands[index], command=lambda  num=index:run(commands[num])).pack(side="left")
  index+=1
  
root.mainloop()



		

Submit a new version

You can submit a new version of this snippet if you have modified it and you feel it is appropriate to share with others..