-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstallprogrambasicapp.py
More file actions
61 lines (50 loc) · 1.66 KB
/
Installprogrambasicapp.py
File metadata and controls
61 lines (50 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import subprocess
import sys
import tkinter as tk
from tkinter import Checkbutton, IntVar, Button
def run_command(command):
try:
subprocess.run(command, check=True, shell=True)
except subprocess.CalledProcessError as e:
print(f"Errore durante l'esecuzione del comando: {e}")
sys.exit(1)
def install_selected_programs(selected_programs):
for program in selected_programs:
print(f"Installing {program}...")
install_command = f"choco install {program} -y"
run_command(install_command)
print("Installazione completata.")
def main():
root = tk.Tk()
root.title("Installazione Programmi")
programs_to_install = [
"googlechrome",
"adobereader",
"klitecodecpackfull",
"youtubemusic",
"firefox",
"7zip",
"hwinfo",
"crystaldiskinfo",
"vlc",
"winrar",
"visualstudiocode",
"libreoffice-still"
]
selected_programs = []
def toggle_program(program):
if program in selected_programs:
selected_programs.remove(program)
else:
selected_programs.append(program)
for program in programs_to_install:
var = IntVar()
checkbox = Checkbutton(root, text=program, variable=var, command=lambda p=program: toggle_program(p))
checkbox.pack(anchor=tk.W)
def install_button_click():
install_selected_programs(selected_programs)
install_button = Button(root, text="Installa", command=install_button_click)
install_button.pack(pady=10)
root.mainloop()
if __name__ == "__main__":
main()