/tags/rel-1-3-25/SWIG/Tools/WAD/Test/death.py
Python | 65 lines | 43 code | 21 blank | 1 comment | 5 complexity | 7f613ed6eaf1c2c03904d28d8fe2985d MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
- import debug
- from Tkinter import *
- def death_by_segmentation():
- debug.seg_crash()
- def death_by_bus():
- debug.bus_crash()
- def death_by_abort():
- debug.abort_crash(-1)
- def death_by_math():
- debug.math_crash(37,0)
- def death_by_buffer():
- debug.overflow_crash()
- def death(f):
- ty = f.tvar.get()
- if ty == 1:
- death_by_segmentation()
- elif ty == 2:
- death_by_abort()
- elif ty == 3:
- death_by_math()
- elif ty == 4:
- death_by_bus()
- elif ty == 5:
- death_by_buffer()
- class death_options(Frame):
- def __init__(self):
- Frame.__init__(self)
- tvar = IntVar()
- Radiobutton(self,text="Segmentation fault", variable=tvar, value=1).pack(anchor=W)
- Radiobutton(self,text="Failed assertion", variable=tvar, value=2).pack(anchor=W)
- Radiobutton(self,text="Math error", variable=tvar, value=3).pack(anchor=W)
- Radiobutton(self,text="Bus error", variable=tvar, value=4).pack(anchor=W)
- Radiobutton(self,text="Stack overflow", variable=tvar, value=5).pack(anchor=W)
- Button(self,text="Die", command=lambda x=self: death(x)).pack(expand=1, fill=BOTH)
- self.tvar = tvar
- tvar.set(1)
- def death_wizard():
- root = Tk()
- l = Label(text="How would you like to die today?")
- l.pack()
- death_options().pack()
- root.title("Death Wizard")
- death_wizard()
- #root.mainloop()