1

Running Python 3.4 on Windows platform.

I want to use ctypes to kick out an error msgbox when no input is put into an input field. code is:

if len(pet) == 0:
   subprocess.call("Python help.py")
if pet == "cat":
    try:
        age = int(input("how old is your cat?"))
    except ValueError:
        print ("put in a number please")

Ctypes code is:

import ctypes  
ctypes.windll.user32.MessageBoxW(0, "Enter data here please", "Input Error", 1) 

My Ctypes msgbox opens perfectly but I end up with a python.exe window opening at the same time. This window closes whenthe msgbox is OK'ed but it looks poor show on screen. Question: How do I get the msgbox to open but not the python.exe window?

jfs
  • 399,953
  • 195
  • 994
  • 1,670
madarelwof
  • 11
  • 4
  • use `.pyw` file extension instead of `.py`, see [How to hide console window in python?](http://stackoverflow.com/questions/764631/how-to-hide-console-window-in-python) – jfs Apr 10 '14 at 20:21

0 Answers0