Advertisement
steve-shambles-2109

Dismal v0.7MP

Nov 26th, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.09 KB | None | 0 0
  1. """
  2. Dismal v0.7MP (short for Disposable Email)
  3. For Windows and Linux.
  4.  
  5. Extremely simple desktop GUI to create
  6. a disposable email address and go to
  7. the inbox, all  accomplished in a few seconds
  8. and just a few clicks.
  9.  
  10. By Steve Shambles Oct 2018.
  11. Updated Nov 2019.
  12. https://stevepython.wordpress.com/
  13.  
  14. pip3 install pyperclip
  15. """
  16. from tkinter import Button, E, Entry, LabelFrame, Menu
  17. from tkinter import messagebox, Tk, W
  18. from random import randint, choice
  19. import string
  20. import sys
  21. import webbrowser
  22.  
  23. import pyperclip
  24.  
  25. base_url = 'https://www.mailinator.com/v3/index.jsp?zone=public&query='
  26. base_email = '@mailinator.com'
  27.  
  28. root = Tk()
  29. # Stop early showing of GUI until messagebox clicked.
  30. root.withdraw()
  31.  
  32. messagebox.showinfo('Mailinator GUI', 'To create a quick disposable, anonymous'
  33.                     ' email address,\nJust type some text (to create a user '
  34.                     'name) into the input box,\nthen click on the Create Email '
  35.                     'button\n\nIf you type nothing in, a random name'
  36.                     ' will be generated for you.')
  37.  
  38. # Create GUI frame.
  39. root = Tk()
  40. root.title('Dismal v0.7')
  41.  
  42. if sys.platform.startswith('win'):
  43.     root.geometry('173x110')
  44.     root.resizable(False, False)
  45. else:
  46.     root.geometry('194x115')
  47.  
  48. main_frame = LabelFrame(root)
  49. main_frame.grid(padx=5, pady=8)
  50.  
  51. def clk_but():
  52.     """Create Email button was clicked"""
  53.     # Get content of entry box.
  54.     e_name = entry_box.get()
  55.  
  56.     if not e_name:
  57.         # If no username entered, create random one.
  58.         allchar = string.ascii_lowercase + string.digits
  59.         e_name = ''.join(choice(allchar) for x in range(randint(6, 8)))
  60.  
  61.     # Construct email address.
  62.     email_address = e_name+base_email
  63.  
  64.     messagebox.showinfo('Info', 'your new email address is '
  65.                         +str(email_address)+'\n\n'
  66.                         'The address has been copied to your clipboard.\n'
  67.                         'Click OK to go to your inbox')
  68.  
  69.     # Copy email address to clipboard.
  70.     pyperclip.copy(email_address)
  71.  
  72.     # Open inbox in browser.
  73.     webbrowser.open(base_url+e_name)
  74.  
  75. def about_menu():
  76.     """About program."""
  77.     messagebox.showinfo('About',
  78.                         'Dismal V0.7 By Steve Shambles 2018.\n'
  79.                         'Updated Nov 2019.')
  80.  
  81. def visit_blog():
  82.     """Visit my blog."""
  83.     webbrowser.open('https://stevepython.wordpress.com/')
  84.  
  85. # Create entry box.
  86. entry_box = Entry(main_frame, bd=3, bg='slategray1')
  87. entry_box.grid(sticky=W+E, padx=5, pady=5)
  88.  
  89. # Create Email button.
  90. create_mail_btn = Button(main_frame, bg='salmon', text='Create Email',
  91.                          command=clk_but)
  92. create_mail_btn.grid(pady=15, padx=15)
  93.  
  94. # Standard dropdown menu.
  95. menu_bar = Menu(root)
  96. file_menu = Menu(menu_bar, tearoff=0)
  97. menu_bar.add_cascade(label='Menu', menu=file_menu)
  98. file_menu.add_command(label='Visit Blog', command=visit_blog)
  99. file_menu.add_separator()
  100. file_menu.add_command(label='About', command=about_menu)
  101. file_menu.add_command(label='Exit', command=root.destroy)
  102. root.config(menu=menu_bar)
  103.  
  104. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement