0
通常、このコードは正常に動作します。Python 3.4 ctypesメッセージボックスが他のコードと一緒に開かない
import ctypes
def message_box(title, text):
ctypes.windll.user32.MessageBoxW(0, text, title, 1)
しかし、他のコードと共に使用すると、message_boxが呼び出された行でハングします。
import ctypes
def message_box(title, text):
ctypes.windll.user32.MessageBoxW(0, text, title, 1)
while True:
time = input("Enter time of the reminder in the format 'HH:MM': ")
if (len(time) != 5):
print("\nInvalid answer\n")
continue
if (time[2] != ":"):
print("\nInvalid answer\n")
continue
try:
hours = int(time[0:2])
minutes = int(time[3:5])
except:
print("\nInvalid answer\n")
continue
if not (0 < hours < 23 or 0 < minutes < 59):
print("\nInvalid answer\n")
continue
break
message_box("Example_title", "Example_text")
Works for me。 'ctypes'のほとんどの問題は、使用されている関数に対して' argtypes'や 'restype'を定義しなかった結果です。 PythonのバージョンとOSの違いは、特定の定義がないと問題を引き起こす可能性が高くなります。 –