0

I'm writing an app in Python 3.4 using tkinter. It is a timer but with two more functions.

  1. When time reaches zero app will shutdown computer (its for windows os generally)
  2. The timer can be stopped when user inputs correct password.

The main window is borderless with blocked Quit button when time is running. But I encountered new problem. Applications can be killed in task manager. So my question is: Is there some way to hide or block from killing process in task manager?

abhi
  • 1,760
  • 1
  • 24
  • 40
guest013
  • 33
  • 1
  • 1
  • 11
  • You should read this thread: http://stackoverflow.com/questions/992671/how-to-write-an-unkillable-process-for-windows – iamdeit Oct 23 '16 at 23:01
  • You cannot. So what you need to do is either *block access to task manager* (see http://ccm.net/faq/41738-how-to-prevent-users-from-accessing-the-task-manager) or run the app as privileged, while your son has a limited user. Trying to kill the app would then get access denied. – LSerni Oct 23 '16 at 23:01
  • You might also just look into off the shelf software - there's things out there that do this already – Daenyth Oct 23 '16 at 23:07
  • Yeah, i could look for this kind app but i want to do it by myself. And i could show my son that computer its not only games – guest013 Oct 23 '16 at 23:18

1 Answers1

1

OK, i have great idea. In my app for shutdown computer im using os.system('shutdown /p /f') but i could use different switches. shutdown /s /t xxx will do the same but in set time, and computer will shut because it will add scheduled task, and in task manager wont be name of my application which solves my problem :) And my application can be even closed, there is no need to make borderless window and using Quit button because 'shutdown' command works in background.

I hope it is not a problem that i by myself found answer for my question. At least i think ive found correct answer. Will check this when ill back from work.

I found 2 external programs that may help me, but i dont know how use them? Can anybody tell me how use nircmd or psexec? I need only shutdown function from them

guest013
  • 33
  • 1
  • 1
  • 11