0

I've created a script in Python, which can run up to a minute. While my script is running I like to give the user a messagebox in windows7 that the script is running.

A possible thing is to display a Message when the script starts and to unload this message when the script is done.

Currently I use tkMessageBox in order to give some information. I also looked at ctypes.windll.user32.MessageBoxA, but couldn't find a solution.

tshepang
  • 12,111
  • 21
  • 91
  • 136
wb1981
  • 1
  • 2

1 Answers1

0

I tried to do this a long time ago. I know this is no beauty way to do it and probably Python hates me a lot for doing it like this but it still worked for me.

You will still get an Error message but it works. Probably someone else can correct me and make it on a better way. Here is the code:

import Tkinter
import tkMessageBox
import thread

top = Tkinter.Tk()
def hello():
    tkMessageBox.showinfo("Say Hello", "Hello World")

B1 = Tkinter.Button(top, text = "Say Hello", command = hello)
B1.pack()

thread_to_stop = thread
try:
    thread_to_stop.start_new_thread(top.mainloop,(0,))
except:
    pass

print "Python doesn't like this very much"
raw_input("You choose when to close it!")
# Do more stuff here....
top.destroy()
pequetrefe
  • 106
  • 3