今後のマウスイベントの通知としてTkinter
を使用しています。プログラムはその主な機能を継続しますが、通知が表示された後も終了します。それを呼び出す関数に戻るためには、後続のコードに何を追加する必要がありますか? after()
にしてcommand=
にあなたが正常にスクリプトを閉じるために使用されexit
を使用しているため通知としてTkinterを使用する次に、プログラムの機能に戻る
def sendMessage():#THIS IS MY NOTIFICATION FUNCTION
popupRoot = Tk()
popupRoot.lift()
popupRoot.attributes('-topmost',True)
popupRoot.after_idle(popupRoot.attributes,'-topmost',False)
popupRoot.after(10000, exit)
popupButton = Button(popupRoot, text = "You have 1 minute until mouse events",
font = ("Verdana", 12), bg = "yellow", command = exit)
popupButton.pack()
popupRoot.geometry('400x50+700+500')
popupRoot.mainloop()
def wait(howLong, runTime, howRuns, day, x): #THIS IS THE FUNCTION THAT CALLED THE NOTIFICATION FUNCTION
while x < howLong:
print "rerun in ", howLong - x, " minute(s)"
messTime = 1
if messTime == 1:
sendMessage()
time.sleep(60)#1 minute delay to allow carts to return
x = x + 1
if x == howLong:
runTime = runTime + 1
print "Run time = ", runTime
print "rerunning program now"
if runTime == howRuns:
exitProgram()
else:
main(howLong, runTime, howRuns, day)
を必要としています。あなたは 'command = popupRoot.destroy'と' after(10000、popupRoot.destroy) ' – furas