Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python
- import Tkinter as tk
- import subprocess, threading
- tabella = (
- ('nome_comando1','comando1'),
- ('nome_comando2','comando2'),
- ('nome_comando3','comando3'),
- )
- def avvia(evento):
- nuovo_thread = threading.Thread(
- target=lambda:subprocess.call(evento.widget.comando))
- nuovo_thread.start()
- evento.widget.update()
- finestra = tk.Tk()
- finestra.title('titolo_finestra')
- finestra.resizable(False, False)
- lb = []
- for indice, (testo, comando) in enumerate(tabella):
- lb.append(tk.Button(finestra, text=testo, width=30))
- lb[indice].comando = comando
- lb[indice].bind('<Button-1>', avvia)
- lb[indice].pack()
- finestra.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement