컴퓨터/Python

python windows 이용 alert 창 띄우기

풍경소리^^ 2020. 10. 13. 00:27

https://stackoverflow.com/questions/177287/alert-boxes-in-python

 

Alert boxes in Python?

Is it possible to produce an alert similar to JavaScript's alert("message") in python, with an application running as a daemon. This will be run in Windows, Most likely XP but 2000 and Vista are a...

stackoverflow.com

import win32api

import win32com.client

import pythoncom

 

result=win32api.MessageBox(0,"작업 완료!", "크롤링")

 

if result==1:

    print('Ok')

elif result==2:

    print('cancel' )

 

====================================

win32api.MessageBox(0,"msgbox", "title")
win32api.MessageBox(0,"ok cancel?", "title",1)
win32api.MessageBox(0,"abort retry ignore?", "title",2)
win32api.MessageBox(0,"yes no cancel?", "title",3)