I'm developing a GUI and I need for the GUI to be able to restart Teamviewer if it crashes.
I tried doing this using the kernel commands on a Team Viewer "Cheat Sheet"
import tkinter as tk
import os
import time
root = tk.Tk()
root.title(string="TeamViewerRebootButton")
root.geometry("200x200")
def closePop_upCallback():
None
def teamviewerReboot():
rebooting = tk.Toplevel(master=root)
label = tk.Label(master=rebooting, text="Rebooting...", font=("", 15))
label.pack()
try:
os.system("sudo teamviewer daemon stop")
os.system("sudo teamviewer daemon start")
label.configure(text"Rebooting Complete")
sleep(1)
rebooting.destroy()
rebootTeamViewer = tk.Button(master=root, text="Restart TeamViewer", command=None)
rebootTeamViewer.pack()
root.mainloop()
while this claims to work, as far as I can tell its not actually restarting TeamViewer.
sudo
should ask you for password butos.system()
will not ask you for password if you don't run it in console.gksudo
orpkexec
to show window for password. It is more secure.try
withoutexcept
- so you should get error.restart
instead ofstop
andstart
. It will also start if deamon doesn't run.