python实现报警提示,代码如下:
#!/bin/python from Tkinter import * class Alarm(Frame): def repeater(self): self.bell() self.after(self.msecs, self.repeater) def __init__(self): Frame.__init__(self) self.msecs = 1000 self.pack() stopper = Button(self, text='Stop the beeps!', command=self.quit) stopper.pack() stopper.config(bg='navy', fg='white', bd=8) self.stopper = stopper self.repeater() if __name__ == '__main__': Alarm().mainloop()效果图,如下: