Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_hide_window.py
- import Tkinter as tk
- def keycodess(event):
- if event.keysym == 'Escape':
- root.destroy()
- x = event.char
- if x == "1":
- print "Option 'ONE' has been selected"
- elif x == "2":
- print "Option 'TWO' has been selected"
- elif x == "3":
- print "Option 'THREE' has been selected"
- elif x == "4":
- print "Option 'FOUR' has been selected"
- else:
- print x
- root = tk.Tk()
- print "1. Menu choice 'ONE'"
- print "2. Menu choice 'TWO'"
- print "3. Menu choice 'THREE'"
- print "4. Menu choice 'FOUR'"
- root.bind_all('<KeyRelease>', keycodess)
- # hiding the tk window
- root.withdraw()
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement