I need to create a message box in python without using python Tkinter library so that I can use that before using exit()
function this will display the message and answer as soon as user presses okay, user gets out of program.
Asked
Active
Viewed 159 times
-2

martineau
- 119,623
- 25
- 170
- 301
-
Windows has a [`msg`](https://www.lifewire.com/msg-command-2618093) command that a Python script could run (via `subprocess.run()` or `os.system()`) to do something like what you want. – martineau Jan 12 '20 at 14:57
-
okay thanks that may help – Venkatesh Joshi Jan 12 '20 at 15:21
1 Answers
0
Here's one way to do it with Windows' msg
command. The code is based on @ErykSun's comment under the question Can't execute msg (and other) Windows commands via subprocess.
import os
import subprocess
sysroot = os.environ['SystemRoot']
sysnative = (os.path.join(sysroot, 'SysNative')
if os.path.exists(os.path.join(sysroot, 'SysNative'))
else
os.path.join(sysroot, 'System32'))
msgexe_path = os.path.join(sysnative, 'msg.exe')
subprocess.run([msgexe_path, '*', 'ALL YOUR BASE ARE WHERE BELONG TO US.'])

martineau
- 119,623
- 25
- 170
- 301