Skip to content Skip to sidebar Skip to footer

Keeping The Script Running When Closing The Window And Opening A Text Editor In Python

As we all know April fools is coming so i tought i would write a nice script to prank someone, a harmless version of the well known and feared MEMZ Virus. The Script i have current

Solution 1:

you can try in-built library ctypes to bring a pop-up on the screen.

import ctypes 
ctypes.windll.user32.MessageBoxW(0, "Your text", "Your title", 1)

Hope this helps.

you can actually use pythonw.exe file instead of python.exe Try this link - I haven't tried this thing but hopes it will help you for sure in hiding window console.

you have to simply change your python file extension from file.py to file.pyw and its done No windows console will show up.

Solution 2:

The solution provided by @Abhishake gupta is good, you can also os module to open a notepad with some text.

import os
f = open('foo.txt','w')
f.write('Hello world!')
f.close()
os.system("notepad.exe foo.txt")

Post a Comment for "Keeping The Script Running When Closing The Window And Opening A Text Editor In Python"