-
Notifications
You must be signed in to change notification settings - Fork 0
1. Importing the Modules
Even if no new modules have to be installed, there are some built-in modules that we will be using. Those will be:
The smtplib module defines an SMTP client session object that can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon. For more information on SMTP, click here
- ssl:
This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both client-side and server-side. This module uses the OpenSSL library. It is available on all modern Unix systems, Windows, Mac OS X, and probably additional platforms, as long as OpenSSL is installed on that platform.
The tkinter package (“Tk interface”) is the standard Python interface to the Tk GUI toolkit. Both Tk and tkinter are available on most Unix platforms, as well as on Windows systems. (Tk itself is not part of Python; it is maintained at ActiveState.) In simple words, tkinter allows you to create an interactive graphical user interface, with widgets, that you cannot do in command-line interfaces.
The tkinter.messagebox module provides a template base class as well as a variety of convenience methods for commonly used configurations. The message boxes are modal and will return a subset of (True, False, OK, None, Yes, No) based on the user’s selection.
The tkinter.scrolledtext module provides a class of the same name which implements a basic text widget which has a vertical scroll bar configured to do the “right thing.” Using the ScrolledText class is a lot easier than setting up a text widget and scroll bar directly.
As you may know, the standard way to import a module or functionis:
from <module> import <function>
import <module>
import <module> as <>
So, this is the code to import the necessary modules:
import smtplib, ssl
import tkinter as tk
from tkinter.scrolledtext import ScrolledText
from tkinter.messagebox import showinfo
Here, in the first line, we imported two modules together. This is for users to understand it, and it doesn't change the code's functionality. Now that all the necessary modules have been imported, we can start using them! Move over to the next page