Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- Dismal v0.7MP (short for Disposable Email)
- For Windows and Linux.
- Extremely simple desktop GUI to create
- a disposable email address and go to
- the inbox, all accomplished in a few seconds
- and just a few clicks.
- By Steve Shambles Oct 2018.
- Updated Nov 2019.
- https://stevepython.wordpress.com/
- pip3 install pyperclip
- """
- from tkinter import Button, E, Entry, LabelFrame, Menu
- from tkinter import messagebox, Tk, W
- from random import randint, choice
- import string
- import sys
- import webbrowser
- import pyperclip
- base_url = 'https://www.mailinator.com/v3/index.jsp?zone=public&query='
- base_email = '@mailinator.com'
- root = Tk()
- # Stop early showing of GUI until messagebox clicked.
- root.withdraw()
- messagebox.showinfo('Mailinator GUI', 'To create a quick disposable, anonymous'
- ' email address,\nJust type some text (to create a user '
- 'name) into the input box,\nthen click on the Create Email '
- 'button\n\nIf you type nothing in, a random name'
- ' will be generated for you.')
- # Create GUI frame.
- root = Tk()
- root.title('Dismal v0.7')
- if sys.platform.startswith('win'):
- root.geometry('173x110')
- root.resizable(False, False)
- else:
- root.geometry('194x115')
- main_frame = LabelFrame(root)
- main_frame.grid(padx=5, pady=8)
- def clk_but():
- """Create Email button was clicked"""
- # Get content of entry box.
- e_name = entry_box.get()
- if not e_name:
- # If no username entered, create random one.
- allchar = string.ascii_lowercase + string.digits
- e_name = ''.join(choice(allchar) for x in range(randint(6, 8)))
- # Construct email address.
- email_address = e_name+base_email
- messagebox.showinfo('Info', 'your new email address is '
- +str(email_address)+'\n\n'
- 'The address has been copied to your clipboard.\n'
- 'Click OK to go to your inbox')
- # Copy email address to clipboard.
- pyperclip.copy(email_address)
- # Open inbox in browser.
- webbrowser.open(base_url+e_name)
- def about_menu():
- """About program."""
- messagebox.showinfo('About',
- 'Dismal V0.7 By Steve Shambles 2018.\n'
- 'Updated Nov 2019.')
- def visit_blog():
- """Visit my blog."""
- webbrowser.open('https://stevepython.wordpress.com/')
- # Create entry box.
- entry_box = Entry(main_frame, bd=3, bg='slategray1')
- entry_box.grid(sticky=W+E, padx=5, pady=5)
- # Create Email button.
- create_mail_btn = Button(main_frame, bg='salmon', text='Create Email',
- command=clk_but)
- create_mail_btn.grid(pady=15, padx=15)
- # Standard dropdown menu.
- menu_bar = Menu(root)
- file_menu = Menu(menu_bar, tearoff=0)
- menu_bar.add_cascade(label='Menu', menu=file_menu)
- file_menu.add_command(label='Visit Blog', command=visit_blog)
- file_menu.add_separator()
- file_menu.add_command(label='About', command=about_menu)
- file_menu.add_command(label='Exit', command=root.destroy)
- root.config(menu=menu_bar)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement