Description stringlengths 9 105 | Link stringlengths 45 135 | Code stringlengths 10 26.8k | Test_Case stringlengths 9 202 | Merge stringlengths 63 27k |
|---|---|---|---|---|
Automate Instagram Messages using Python | https://www.geeksforgeeks.org/automate-instagram-messages-using-python/ | # you can take any valid username
audience = ["sundarpichai", "virat.kholi", "rudymancuso"]
message = "testing of a bot" |
#Output : pip install selenium | Automate Instagram Messages using Python
# you can take any valid username
audience = ["sundarpichai", "virat.kholi", "rudymancuso"]
message = "testing of a bot"
#Output : pip install selenium
[END] |
Automate Instagram Messages using Python | https://www.geeksforgeeks.org/automate-instagram-messages-using-python/ | class bot:
def __init__(self, username, password, audience, message):
# initializing the username
self.username = username
# initializing the password
self.password = password
# passing the list of user or initializing
self.user = user
# passing the message... |
#Output : pip install selenium | Automate Instagram Messages using Python
class bot:
def __init__(self, username, password, audience, message):
# initializing the username
self.username = username
# initializing the password
self.password = password
# passing the list of user or initializing
self.u... |
Automate Instagram Messages using Python | https://www.geeksforgeeks.org/automate-instagram-messages-using-python/ | def login(self):
self.bot.get(self.base_url)
# ENTERING THE USERNAME FOR LOGIN INTO INSTAGRAM
enter_username = WebDriverWait(self.bot, 20).until(
expected_conditions.presence_of_element_located((By.NAME, "username"))
)
enter_username.send_keys(self.username)
# ENTERING THE PASSWORD FO... |
#Output : pip install selenium | Automate Instagram Messages using Python
def login(self):
self.bot.get(self.base_url)
# ENTERING THE USERNAME FOR LOGIN INTO INSTAGRAM
enter_username = WebDriverWait(self.bot, 20).until(
expected_conditions.presence_of_element_located((By.NAME, "username"))
)
enter_username.send_keys(self.... |
Automate Instagram Messages using Python | https://www.geeksforgeeks.org/automate-instagram-messages-using-python/ | # first pop-up box
self.bot.find_element_by_xpath(
'//*[@id="react-root"]/section/main/div/div/div/div/button'
).click()
time.sleep(3)
# 2nd pop-up box
self.bot.find_element_by_xpath("/html/body/div[4]/div/div/div/div[3]/button[2]").click()
time.sleep(4) |
#Output : pip install selenium | Automate Instagram Messages using Python
# first pop-up box
self.bot.find_element_by_xpath(
'//*[@id="react-root"]/section/main/div/div/div/div/button'
).click()
time.sleep(3)
# 2nd pop-up box
self.bot.find_element_by_xpath("/html/body/div[4]/div/div/div/div[3]/button[2]").click()
time.sleep(4)
#Output : pip i... |
Automate Instagram Messages using Python | https://www.geeksforgeeks.org/automate-instagram-messages-using-python/ | # this will click on message(direct) option.
self.bot.find_element_by_xpath(
'//a[@class="xWeGp"]/*[name()="svg"][@aria-label="Direct"]'
).click()
time.sleep(3) |
#Output : pip install selenium | Automate Instagram Messages using Python
# this will click on message(direct) option.
self.bot.find_element_by_xpath(
'//a[@class="xWeGp"]/*[name()="svg"][@aria-label="Direct"]'
).click()
time.sleep(3)
#Output : pip install selenium
[END] |
Automate Instagram Messages using Python | https://www.geeksforgeeks.org/automate-instagram-messages-using-python/ | # This will click on the pencil icon as shown in the figure.
self.bot.find_element_by_xpath(
'//*[@id="react-root"]/section/div/div[2]/div/div/div[2]/div/button'
).click()
time.sleep(2) |
#Output : pip install selenium | Automate Instagram Messages using Python
# This will click on the pencil icon as shown in the figure.
self.bot.find_element_by_xpath(
'//*[@id="react-root"]/section/div/div[2]/div/div/div[2]/div/button'
).click()
time.sleep(2)
#Output : pip install selenium
[END] |
Automate Instagram Messages using Python | https://www.geeksforgeeks.org/automate-instagram-messages-using-python/ | for i in user:
# enter the username
self.bot.find_element_by_xpath(
"/html/body/div[4]/div/div/div[2]/div[1]/div/div[2]/input"
).send_keys(i)
time.sleep(2)
# click on the username
self.bot.find_element_by_xpath(
"/html/body/div[4]/div/div/div[2]/div[2]/div"
).click()
tim... |
#Output : pip install selenium | Automate Instagram Messages using Python
for i in user:
# enter the username
self.bot.find_element_by_xpath(
"/html/body/div[4]/div/div/div[2]/div[1]/div/div[2]/input"
).send_keys(i)
time.sleep(2)
# click on the username
self.bot.find_element_by_xpath(
"/html/body/div[4]/div/div... |
Automate Instagram Messages using Python | https://www.geeksforgeeks.org/automate-instagram-messages-using-python/ | def init():
# you can even enter your personal account.
bot("username", "password", user, message_)
input("DONE") |
#Output : pip install selenium | Automate Instagram Messages using Python
def init():
# you can even enter your personal account.
bot("username", "password", user, message_)
input("DONE")
#Output : pip install selenium
[END] |
Automate Instagram Messages using Python | https://www.geeksforgeeks.org/automate-instagram-messages-using-python/ | # calling this function will message everyone's
# that is on your user's list...:)
init() |
#Output : pip install selenium | Automate Instagram Messages using Python
# calling this function will message everyone's
# that is on your user's list...:)
init()
#Output : pip install selenium
[END] |
Automate Instagram Messages using Python | https://www.geeksforgeeks.org/automate-instagram-messages-using-python/ | # importing module
from selenium import webdriver
import os
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.keys import Keys
from webdriver_manager.chrome import Chro... |
#Output : pip install selenium | Automate Instagram Messages using Python
# importing module
from selenium import webdriver
import os
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.common.keys import Keys
... |
Automating Happy Birthday post on Facebook | https://www.geeksforgeeks.org/python-automating-happy-birthday-post-on-facebook-using-selenium/ | # importing necessary classes
# from different modules
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
from selenium.c... |
#Output : pip install selenium | Automating Happy Birthday post on Facebook
# importing necessary classes
# from different modules
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.ch... |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | class Square:
def __init__(self, side):
"""creates a square having the given side"""
self.side = side
def area(self):
"""returns area of the square"""
return self.side**2
def perimeter(self):
"""returns perimeter of the square"""
return 4 * self.side
de... |
#Output : ---Software_Testing | Automated software testing with Python
class Square:
def __init__(self, side):
"""creates a square having the given side"""
self.side = side
def area(self):
"""returns area of the square"""
return self.side**2
def perimeter(self):
"""returns perimeter of the square"... |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | def test_area(self):
# testing the method Square.area().
sq = Square(2) # creates a Square of side 2 units.
# test if the area of the above square is 4 units,
# display an error message if it's not.
self.assertEqual(
sq.area(), 4, f"Area is shown {sq.area()} for side = {sq.side} units"
... |
#Output : ---Software_Testing | Automated software testing with Python
def test_area(self):
# testing the method Square.area().
sq = Square(2) # creates a Square of side 2 units.
# test if the area of the above square is 4 units,
# display an error message if it's not.
self.assertEqual(
sq.area(), 4, f"Area is shown {s... |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | if __name__ == "__main__":
unittest.main() |
#Output : ---Software_Testing | Automated software testing with Python
if __name__ == "__main__":
unittest.main()
#Output : ---Software_Testing
[END] |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | import unittest
from .. import app
class TestSum(unittest.TestCase):
def test_area(self):
sq = app.Square(2)
self.assertEqual(sq.area(), 4, f"Area is shown {sq.area()} rather than 9")
if __name__ == "__main__":
unittest.main() |
#Output : ---Software_Testing | Automated software testing with Python
import unittest
from .. import app
class TestSum(unittest.TestCase):
def test_area(self):
sq = app.Square(2)
self.assertEqual(sq.area(), 4, f"Area is shown {sq.area()} rather than 9")
if __name__ == "__main__":
unittest.main()
#Output : ---Software_... |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | import unittest
from .. import app
class TestSum(unittest.TestCase):
def test_area(self):
sq = app.Square(2)
self.assertEqual(sq.area(), 4, f"Area is shown {sq.area()} rather than 9")
def test_area_negative(self):
sq = app.Square(-3)
self.assertEqual(sq.area(), -1, f"Area is s... |
#Output : ---Software_Testing | Automated software testing with Python
import unittest
from .. import app
class TestSum(unittest.TestCase):
def test_area(self):
sq = app.Square(2)
self.assertEqual(sq.area(), 4, f"Area is shown {sq.area()} rather than 9")
def test_area_negative(self):
sq = app.Square(-3)
self... |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | from .. import app??????def test_file1_area():????????????????????????sq = app.Square(2)????????????????????????ass"area for side {sq.side} units is {sq.area()}"??def test_file1_perimeter():????????sq = app.Square(-1)????????assert sq.perimeter() == -1,????????????????f'perimeter is shown {sq.perimeter()} rather than -... |
#Output : ---Software_Testing | Automated software testing with Python
from .. import app??????def test_file1_area():????????????????????????sq = app.Square(2)????????????????????????ass"area for side {sq.side} units is {sq.area()}"??def test_file1_perimeter():????????sq = app.Square(-1)????????assert sq.perimeter() == -1,????????????????f'perimeter ... |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | # @pytest.mark.<tag_name>@pytest.mark.area??????????????????????????????def test_file1_area():????????????????????????sq = app.Square(2)???????????"area for side {sq.side} units is {sq.area()}" |
#Output : ---Software_Testing | Automated software testing with Python
# @pytest.mark.<tag_name>@pytest.mark.area??????????????????????????????def test_file1_area():????????????????????????sq = app.Square(2)???????????"area for side {sq.side} units is {sq.area()}"
#Output : ---Software_Testing
[END] |
Automate Google Search | https://www.geeksforgeeks.org/python-automate-google-search-using-selenium/ | from selenium import webdriver
# Taking input from user
search_string = input("Input the URL or string you want to search for:")
# This is done to structure the string
# into search url.(This can be ignored)
search_string = search_string.replace(" ", "+")
# Assigning the browser variable with chromedriver of Chrome.... |
#Output :
| Automate Google Search
from selenium import webdriver
# Taking input from user
search_string = input("Input the URL or string you want to search for:")
# This is done to structure the string
# into search url.(This can be ignored)
search_string = search_string.replace(" ", "+")
# Assigning the browser variable with ... |
Automate Google Search | https://www.geeksforgeeks.org/python-automate-google-search-using-selenium/ | from selenium import webdriver
import sys
# function to convert a list into string
def convert(s):
str1 = ""
return str1.join(s)
# Assign the arguments passed to a variable search_string
search_string = sys.argv[1:]
# The argument passed to the program is accepted
# as list, it is needed to convert that in... |
#Output :
| Automate Google Search
from selenium import webdriver
import sys
# function to convert a list into string
def convert(s):
str1 = ""
return str1.join(s)
# Assign the arguments passed to a variable search_string
search_string = sys.argv[1:]
# The argument passed to the program is accepted
# as list, it is ne... |
Automate linkedin connections using Python | https://www.geeksforgeeks.org/automate-linkedin-connections-using-python/ | # connect python with webbrowser-chrome
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import pyautogui as pag
def login():
# Getting the login element
username = driver.find_element_by_id("login-email")
# Sending the keys for username
username.send_keys("username")
... |
#Output : pip install selenium | Automate linkedin connections using Python
# connect python with webbrowser-chrome
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import pyautogui as pag
def login():
# Getting the login element
username = driver.find_element_by_id("login-email")
# Sending the keys for use... |
Automated Trading using Python | https://www.geeksforgeeks.org/automated-trading-using-python/ | import pandas as pd
import quandl as qd
qd.ApiConfig.api_key = "API KEY"
msft_data = qd.get("EOD/MSFT", start_date="2010-01-01", end_date="2020-01-01")
msft_data.head() |
#Output : pip install quandl | Automated Trading using Python
import pandas as pd
import quandl as qd
qd.ApiConfig.api_key = "API KEY"
msft_data = qd.get("EOD/MSFT", start_date="2010-01-01", end_date="2020-01-01")
msft_data.head()
#Output : pip install quandl
[END] |
Automated Trading using Python | https://www.geeksforgeeks.org/automated-trading-using-python/ | # Import numpy package
import numpy as np
# assign `Adj Close` to `close_price`
close_price = msft_data[["Adj_Close"]]
# returns as fractional change
daily_return = close_price.pct_change()
# replacing NA values with 0
daily_return.fillna(0, inplace=True)
print(daily_return) |
#Output : pip install quandl | Automated Trading using Python
# Import numpy package
import numpy as np
# assign `Adj Close` to `close_price`
close_price = msft_data[["Adj_Close"]]
# returns as fractional change
daily_return = close_price.pct_change()
# replacing NA values with 0
daily_return.fillna(0, inplace=True)
print(daily_return)
#Output... |
Automated Trading using Python | https://www.geeksforgeeks.org/automated-trading-using-python/ | # assigning adjusted closing prices
# to adj_prices
adj_price = msft_data["Adj_Close"]
# calculate the moving average
mav = adj_price.rolling(window=50).mean()
# print the result
print(mav[-10:]) |
#Output : pip install quandl | Automated Trading using Python
# assigning adjusted closing prices
# to adj_prices
adj_price = msft_data["Adj_Close"]
# calculate the moving average
mav = adj_price.rolling(window=50).mean()
# print the result
print(mav[-10:])
#Output : pip install quandl
[END] |
Automated Trading using Python | https://www.geeksforgeeks.org/automated-trading-using-python/ | # import the matplotlib package
# to see the plot
import matplotlib.pyplot as plt
adj_price.plot() |
#Output : pip install quandl | Automated Trading using Python
# import the matplotlib package
# to see the plot
import matplotlib.pyplot as plt
adj_price.plot()
#Output : pip install quandl
[END] |
Automated Trading using Python | https://www.geeksforgeeks.org/automated-trading-using-python/ | mav.plot() |
#Output : pip install quandl | Automated Trading using Python
mav.plot()
#Output : pip install quandl
[END] |
Automated Trading using Python | https://www.geeksforgeeks.org/automated-trading-using-python/ | # import the matplotlib package
# to see the plot
import matplotlib.pyplot as plt
adj_price.plot()
mav.plot() |
#Output : pip install quandl | Automated Trading using Python
# import the matplotlib package
# to see the plot
import matplotlib.pyplot as plt
adj_price.plot()
mav.plot()
#Output : pip install quandl
[END] |
Bulk Posting on Facebook Pages using Selementsenium | https://www.geeksforgeeks.org/bulk-posting-on-facebook-pages-using-selenium/ | # Social Bot Version 1 Codes:??????from selenium import webdriverfrom selenium.webdriver.common.keys import Keysimport timeimport jsonimport os????????????class Social_bot:????????????????????????def __init__(self):??????????????????????????????????????????????????????# instance/class variables?????"https://www.faceboo... |
#Output : pip install selenium | Bulk Posting on Facebook Pages using Selementsenium
# Social Bot Version 1 Codes:??????from selenium import webdriverfrom selenium.webdriver.common.keys import Keysimport timeimport jsonimport os????????????class Social_bot:????????????????????????def __init__(self):?????????????????????????????????????????????????????... |
Share WhatsApp Web without Scanning QR code using Python | https://www.geeksforgeeks.org/share-whatsapp-web-without-scanning-qr-code-using-python/ | function getResultFromRequest(request) {????????????????????????return new Promise((resolve, reject) => {????????????????????????????????????????????????request.onsuccess = function (event) {????????????????????????????????????????????????????????????????????????resolve(request.result);??????"wawc");???????????????????... |
#Output : python session_generator.py session.wa | Share WhatsApp Web without Scanning QR code using Python
function getResultFromRequest(request) {????????????????????????return new Promise((resolve, reject) => {????????????????????????????????????????????????request.onsuccess = function (event) {????????????????????????????????????????????????????????????????????????... |
Share WhatsApp Web without Scanning QR code using Python | https://www.geeksforgeeks.org/share-whatsapp-web-without-scanning-qr-code-using-python/ | JSON.stringify(session) |
#Output : python session_generator.py session.wa | Share WhatsApp Web without Scanning QR code using Python
JSON.stringify(session)
#Output : python session_generator.py session.wa
[END] |
Share WhatsApp Web without Scanning QR code using Python | https://www.geeksforgeeks.org/share-whatsapp-web-without-scanning-qr-code-using-python/ | function getResultFromRequest(request) {????????????????????????return new Promise((resolve, reject) => {????????????????????????????????????????????????request.onsuccess = function(event) {????????????????????????????????????????????????????????????????????????resolve(request.result);?????"wawc");?????????????????????... |
#Output : python session_generator.py session.wa | Share WhatsApp Web without Scanning QR code using Python
function getResultFromRequest(request) {????????????????????????return new Promise((resolve, reject) => {????????????????????????????????????????????????request.onsuccess = function(event) {????????????????????????????????????????????????????????????????????????r... |
Share WhatsApp Web without Scanning QR code using Python | https://www.geeksforgeeks.org/share-whatsapp-web-without-scanning-qr-code-using-python/ | def _wait_for_presence_of_an_element(browser, selector):
element = None
try:
element = WebDriverWait(browser, DEFAULT_WAIT).until(
EC.presence_of_element_located(selector)
)
except:
pass
finally:
return element |
#Output : python session_generator.py session.wa | Share WhatsApp Web without Scanning QR code using Python
def _wait_for_presence_of_an_element(browser, selector):
element = None
try:
element = WebDriverWait(browser, DEFAULT_WAIT).until(
EC.presence_of_element_located(selector)
)
except:
pass
finally:
return... |
Share WhatsApp Web without Scanning QR code using Python | https://www.geeksforgeeks.org/share-whatsapp-web-without-scanning-qr-code-using-python/ | def sessionGenerator(sessionFilePath):
# 1.1 Open Chrome browser
browser = webdriver.Chrome()
# 1.2 Open Web Whatsapp
browser.get("https://web.whatsapp.com/")
# 1.3 Ask user to scan QR code
print("Waiting for QR code scan...")
# 1.4 Wait for QR code to be scanned
_wait_for_presence_of... |
#Output : python session_generator.py session.wa | Share WhatsApp Web without Scanning QR code using Python
def sessionGenerator(sessionFilePath):
# 1.1 Open Chrome browser
browser = webdriver.Chrome()
# 1.2 Open Web Whatsapp
browser.get("https://web.whatsapp.com/")
# 1.3 Ask user to scan QR code
print("Waiting for QR code scan...")
# 1.4... |
Share WhatsApp Web without Scanning QR code using Python | https://www.geeksforgeeks.org/share-whatsapp-web-without-scanning-qr-code-using-python/ | from session import *
import sys
# Take session file path as command line
# argument and passed to following method
sessionFilePath = sys.argv[1]
sessionGenerator(sessionFilePath) |
#Output : python session_generator.py session.wa | Share WhatsApp Web without Scanning QR code using Python
from session import *
import sys
# Take session file path as command line
# argument and passed to following method
sessionFilePath = sys.argv[1]
sessionGenerator(sessionFilePath)
#Output : python session_generator.py session.wa
[END] |
Share WhatsApp Web without Scanning QR code using Python | https://www.geeksforgeeks.org/share-whatsapp-web-without-scanning-qr-code-using-python/ | def sessionOpener(sessionFilePath):
# 2.1 Verify that session file is exist
if sessionFilePath == "":
raise IOError('"' + sessionFilePath + '" is not exist.')
# 2.2 Read the given file into "session" variable
with open(sessionFilePath, "r", encoding="utf-8") as sessionFile:
session = se... |
#Output : python session_generator.py session.wa | Share WhatsApp Web without Scanning QR code using Python
def sessionOpener(sessionFilePath):
# 2.1 Verify that session file is exist
if sessionFilePath == "":
raise IOError('"' + sessionFilePath + '" is not exist.')
# 2.2 Read the given file into "session" variable
with open(sessionFilePath, "r... |
Share WhatsApp Web without Scanning QR code using Python | https://www.geeksforgeeks.org/share-whatsapp-web-without-scanning-qr-code-using-python/ | from session import *
import sys
# Take session file path as command line
# argument and passed to following method
sessionFilePath = sys.argv[1]
sessionOpener(sessionFilePath) |
#Output : python session_generator.py session.wa | Share WhatsApp Web without Scanning QR code using Python
from session import *
import sys
# Take session file path as command line
# argument and passed to following method
sessionFilePath = sys.argv[1]
sessionOpener(sessionFilePath)
#Output : python session_generator.py session.wa
[END] |
Automate WhatsApp Messages With Python using Pywhatkit module | https://www.geeksforgeeks.org/automate-whatsapp-messages-with-python-using-pywhatkit-module/ | import pywhatkit
pywhatkit.sendwhatmsg("+919xxxxxxxxx", "Geeks For Geeks!", 18, 30) |
#Output : pip install pywhatkit | Automate WhatsApp Messages With Python using Pywhatkit module
import pywhatkit
pywhatkit.sendwhatmsg("+919xxxxxxxxx", "Geeks For Geeks!", 18, 30)
#Output : pip install pywhatkit
[END] |
How to Send Automated Email Messages in Python | https://www.geeksforgeeks.org/how-to-send-automated-email-messages-in-python/ | from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
import smtplib
import os |
#Output : pip install schedule | How to Send Automated Email Messages in Python
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
import smtplib
import os
#Output : pip install schedule
[END] |
How to Send Automated Email Messages in Python | https://www.geeksforgeeks.org/how-to-send-automated-email-messages-in-python/ | smtp = smtplib.SMTP("smtp.gmail.com", 587)
smtp.ehlo()
smtp.starttls()
smtp.login("YourMail@gmail.com", "Your Password") |
#Output : pip install schedule | How to Send Automated Email Messages in Python
smtp = smtplib.SMTP("smtp.gmail.com", 587)
smtp.ehlo()
smtp.starttls()
smtp.login("YourMail@gmail.com", "Your Password")
#Output : pip install schedule
[END] |
How to Send Automated Email Messages in Python | https://www.geeksforgeeks.org/how-to-send-automated-email-messages-in-python/ | msg = MIMEMultipart()
msg["Subject"] = subject
msg.attach(MIMEText(text)) |
#Output : pip install schedule | How to Send Automated Email Messages in Python
msg = MIMEMultipart()
msg["Subject"] = subject
msg.attach(MIMEText(text))
#Output : pip install schedule
[END] |
How to Send Automated Email Messages in Python | https://www.geeksforgeeks.org/how-to-send-automated-email-messages-in-python/ | img_data = open(one_img, "rb").read()
msg.attach(MIMEImage(img_data, name=os.path.basename(one_img))) |
#Output : pip install schedule | How to Send Automated Email Messages in Python
img_data = open(one_img, "rb").read()
msg.attach(MIMEImage(img_data, name=os.path.basename(one_img)))
#Output : pip install schedule
[END] |
How to Send Automated Email Messages in Python | https://www.geeksforgeeks.org/how-to-send-automated-email-messages-in-python/ | with open(one_attachment, "rb") as f:
file = MIMEApplication(f.read(), name=os.path.basename(one_attachment))
file[
"Content-Disposition"
] = f'attachment; \
filename="{os.path.basename(one_attachment)}"'
msg.attach(file) |
#Output : pip install schedule | How to Send Automated Email Messages in Python
with open(one_attachment, "rb") as f:
file = MIMEApplication(f.read(), name=os.path.basename(one_attachment))
file[
"Content-Disposition"
] = f'attachment; \
filename="{os.path.basename(one_attachment)}"'
msg.attach(file)
#Output : pip instal... |
How to Send Automated Email Messages in Python | https://www.geeksforgeeks.org/how-to-send-automated-email-messages-in-python/ | to = ["klm@gmail.com", "xyz@gmail.com", "abc@gmail.com"]
smtp.sendmail(from_addr="Your Login Email", to_addrs=to, msg=msg.as_string())
smtp.quit() |
#Output : pip install schedule | How to Send Automated Email Messages in Python
to = ["klm@gmail.com", "xyz@gmail.com", "abc@gmail.com"]
smtp.sendmail(from_addr="Your Login Email", to_addrs=to, msg=msg.as_string())
smtp.quit()
#Output : pip install schedule
[END] |
How to Send Automated Email Messages in Python | https://www.geeksforgeeks.org/how-to-send-automated-email-messages-in-python/ | # Import the following module
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
import smtplib
import os
# initialize connection to our
# email server, we will use gmail here
smtp = smtplib.SMTP(... |
#Output : pip install schedule | How to Send Automated Email Messages in Python
# Import the following module
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
import smtplib
import os
# initialize connection to our
# email serv... |
How to Send Automated Email Messages in Python | https://www.geeksforgeeks.org/how-to-send-automated-email-messages-in-python/ | import schedule
import time
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
import smtplib
import os
# send our email message 'msg' to our boss
def message(subject="Python Notification", text=... |
#Output : pip install schedule | How to Send Automated Email Messages in Python
import schedule
import time
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
import smtplib
import os
# send our email message 'msg' to our boss
d... |
Automate backup with Python Script | https://www.geeksforgeeks.org/automate-backup-with-python-script/ | import shutil
from datetime import date
import os
import sys |
#Output : shutil.copytree(src_file_name, dst_dir) | Automate backup with Python Script
import shutil
from datetime import date
import os
import sys
#Output : shutil.copytree(src_file_name, dst_dir)
[END] |
Automate backup with Python Script | https://www.geeksforgeeks.org/automate-backup-with-python-script/ | today = date.today()
date_format = today.strftime("%d_%b_%Y_") |
#Output : shutil.copytree(src_file_name, dst_dir) | Automate backup with Python Script
today = date.today()
date_format = today.strftime("%d_%b_%Y_")
#Output : shutil.copytree(src_file_name, dst_dir)
[END] |
Automate backup with Python Script | https://www.geeksforgeeks.org/automate-backup-with-python-script/ | src_dir = src_dir + src_file_name |
#Output : shutil.copytree(src_file_name, dst_dir) | Automate backup with Python Script
src_dir = src_dir + src_file_name
#Output : shutil.copytree(src_file_name, dst_dir)
[END] |
Automate backup with Python Script | https://www.geeksforgeeks.org/automate-backup-with-python-script/ | os.chdir(sys.path[0]) |
#Output : shutil.copytree(src_file_name, dst_dir) | Automate backup with Python Script
os.chdir(sys.path[0])
#Output : shutil.copytree(src_file_name, dst_dir)
[END] |
Automate backup with Python Script | https://www.geeksforgeeks.org/automate-backup-with-python-script/ | if not src_file_name:
print("Please give atleast the Source File Name") |
#Output : shutil.copytree(src_file_name, dst_dir) | Automate backup with Python Script
if not src_file_name:
print("Please give atleast the Source File Name")
#Output : shutil.copytree(src_file_name, dst_dir)
[END] |
Automate backup with Python Script | https://www.geeksforgeeks.org/automate-backup-with-python-script/ | if src_file_name and dst_file_name and src_dir and dst_dir:
src_dir = src_dir + src_file_name
dst_dir = dst_dir + dst_file_name |
#Output : shutil.copytree(src_file_name, dst_dir) | Automate backup with Python Script
if src_file_name and dst_file_name and src_dir and dst_dir:
src_dir = src_dir + src_file_name
dst_dir = dst_dir + dst_file_name
#Output : shutil.copytree(src_file_name, dst_dir)
[END] |
Automate backup with Python Script | https://www.geeksforgeeks.org/automate-backup-with-python-script/ | elif dst_file_name is None or not dst_file_name:??????????????????????????????????????????dst_file_name = src_file_name????????????????????????????? |
#Output : shutil.copytree(src_file_name, dst_dir) | Automate backup with Python Script
elif dst_file_name is None or not dst_file_name:??????????????????????????????????????????dst_file_name = src_file_name?????????????????????????????
#Output : shutil.copytree(src_file_name, dst_dir)
[END] |
Automate backup with Python Script | https://www.geeksforgeeks.org/automate-backup-with-python-script/ | elif dst_file_name.isspace():????????????????????????????????????dst_file_name = src_file_name??????????????????????????????? |
#Output : shutil.copytree(src_file_name, dst_dir) | Automate backup with Python Script
elif dst_file_name.isspace():????????????????????????????????????dst_file_name = src_file_name???????????????????????????????
#Output : shutil.copytree(src_file_name, dst_dir)
[END] |
Automate backup with Python Script | https://www.geeksforgeeks.org/automate-backup-with-python-script/ | else:????????????????????????????????????dst_dir = dst_dir+d |
#Output : shutil.copytree(src_file_name, dst_dir) | Automate backup with Python Script
else:????????????????????????????????????dst_dir = dst_dir+d
#Output : shutil.copytree(src_file_name, dst_dir)
[END] |
Automate backup with Python Script | https://www.geeksforgeeks.org/automate-backup-with-python-script/ | shutil.copy2(src_dir, dst_dir) |
#Output : shutil.copytree(src_file_name, dst_dir) | Automate backup with Python Script
shutil.copy2(src_dir, dst_dir)
#Output : shutil.copytree(src_file_name, dst_dir)
[END] |
Automate backup with Python Script | https://www.geeksforgeeks.org/automate-backup-with-python-script/ | # Import the following modules
import shutil
from datetime import date
import os
import sys
# When there is need, just change the directory
os.chdir(sys.path[0])
# Function for performing the
# backup of the files and folders
def take_backup(src_file_name, dst_file_name=None, src_dir="", dst_dir=""):
try:
... |
#Output : shutil.copytree(src_file_name, dst_dir) | Automate backup with Python Script
# Import the following modules
import shutil
from datetime import date
import os
import sys
# When there is need, just change the directory
os.chdir(sys.path[0])
# Function for performing the
# backup of the files and folders
def take_backup(src_file_name, dst_file_name=None, src_d... |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | class Square:
def __init__(self, side):
"""creates a square having the given side"""
self.side = side
def area(self):
"""returns area of the square"""
return self.side**2
def perimeter(self):
"""returns perimeter of the square"""
return 4 * self.side
de... |
#Output : ---Software_Testing | Automated software testing with Python
class Square:
def __init__(self, side):
"""creates a square having the given side"""
self.side = side
def area(self):
"""returns area of the square"""
return self.side**2
def perimeter(self):
"""returns perimeter of the square"... |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | def test_area(self):
# testing the method Square.area().
sq = Square(2) # creates a Square of side 2 units.
# test if the area of the above square is 4 units,
# display an error message if it's not.
self.assertEqual(
sq.area(), 4, f"Area is shown {sq.area()} for side = {sq.side} units"
... |
#Output : ---Software_Testing | Automated software testing with Python
def test_area(self):
# testing the method Square.area().
sq = Square(2) # creates a Square of side 2 units.
# test if the area of the above square is 4 units,
# display an error message if it's not.
self.assertEqual(
sq.area(), 4, f"Area is shown {s... |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | if __name__ == "__main__":
unittest.main() |
#Output : ---Software_Testing | Automated software testing with Python
if __name__ == "__main__":
unittest.main()
#Output : ---Software_Testing
[END] |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | import unittest
from .. import app
class TestSum(unittest.TestCase):
def test_area(self):
sq = app.Square(2)
self.assertEqual(sq.area(), 4, f"Area is shown {sq.area()} rather than 9")
if __name__ == "__main__":
unittest.main() |
#Output : ---Software_Testing | Automated software testing with Python
import unittest
from .. import app
class TestSum(unittest.TestCase):
def test_area(self):
sq = app.Square(2)
self.assertEqual(sq.area(), 4, f"Area is shown {sq.area()} rather than 9")
if __name__ == "__main__":
unittest.main()
#Output : ---Software_... |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | import unittest
from .. import app
class TestSum(unittest.TestCase):
def test_area(self):
sq = app.Square(2)
self.assertEqual(sq.area(), 4, f"Area is shown {sq.area()} rather than 9")
def test_area_negative(self):
sq = app.Square(-3)
self.assertEqual(sq.area(), -1, f"Area is s... |
#Output : ---Software_Testing | Automated software testing with Python
import unittest
from .. import app
class TestSum(unittest.TestCase):
def test_area(self):
sq = app.Square(2)
self.assertEqual(sq.area(), 4, f"Area is shown {sq.area()} rather than 9")
def test_area_negative(self):
sq = app.Square(-3)
self... |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | from .. import app??????def test_file1_area():????????????????????????sq = app.Square(2)????????????????????????ass"area for side {sq.side} units is {sq.area()}"??def test_file1_perimeter():????????sq = app.Square(-1)????????assert sq.perimeter() == -1,????????????????f'perimeter is shown {sq.perimeter()} rather than -... |
#Output : ---Software_Testing | Automated software testing with Python
from .. import app??????def test_file1_area():????????????????????????sq = app.Square(2)????????????????????????ass"area for side {sq.side} units is {sq.area()}"??def test_file1_perimeter():????????sq = app.Square(-1)????????assert sq.perimeter() == -1,????????????????f'perimeter ... |
Automated software testing with Python | https://www.geeksforgeeks.org/automated-software-testing-with-python/ | # @pytest.mark.<tag_name>@pytest.mark.area??????????????????????????????def test_file1_area():????????????????????????sq = app.Square(2)???????????"area for side {sq.side} units is {sq.area()}" |
#Output : ---Software_Testing | Automated software testing with Python
# @pytest.mark.<tag_name>@pytest.mark.area??????????????????????????????def test_file1_area():????????????????????????sq = app.Square(2)???????????"area for side {sq.side} units is {sq.area()}"
#Output : ---Software_Testing
[END] |
Hotword detection with Python | https://www.geeksforgeeks.org/hotword-detection-with-python/ | from snowboy import snowboydecode |
#Output : sudo apt-get update | Hotword detection with Python
from snowboy import snowboydecode
#Output : sudo apt-get update
[END] |
Hotword detection with Python | https://www.geeksforgeeks.org/hotword-detection-with-python/ | from snowboy import snowboydecoder
def detected_callback():
print("hotword detected")
# do your task here or call other program.
detector = snowboydecoder.HotwordDetector("hotword.pmdl", sensitivity=0.5, audio_gain=1)
detector.start(detected_callback) |
#Output : sudo apt-get update | Hotword detection with Python
from snowboy import snowboydecoder
def detected_callback():
print("hotword detected")
# do your task here or call other program.
detector = snowboydecoder.HotwordDetector("hotword.pmdl", sensitivity=0.5, audio_gain=1)
detector.start(detected_callback)
#Output : sudo apt-ge... |
Automate linkedin connections using Python | https://www.geeksforgeeks.org/automate-linkedin-connections-using-python/ | # connect python with webbrowser-chrome
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import pyautogui as pag
def login():
# Getting the login element
username = driver.find_element_by_id("login-email")
# Sending the keys for username
username.send_keys("username")
... |
#Output : pip install selenium | Automate linkedin connections using Python
# connect python with webbrowser-chrome
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import pyautogui as pag
def login():
# Getting the login element
username = driver.find_element_by_id("login-email")
# Sending the keys for use... |
Create Table Using Tkinter | https://www.geeksforgeeks.org/create-table-using-tkinter/ | # Python program to create a table
from tkinter import *
class Table:
def __init__(self, root):
# code for creating table
for i in range(total_rows):
for j in range(total_columns):
self.e = Entry(root, width=20, fg="blue", font=("Arial", 16, "bold"))
s... |
#Output : for i in range(5): | Create Table Using Tkinter
# Python program to create a table
from tkinter import *
class Table:
def __init__(self, root):
# code for creating table
for i in range(total_rows):
for j in range(total_columns):
self.e = Entry(root, width=20, fg="blue", font=("Arial", 16, ... |
Image Viewer App in Python using Tkinter | https://www.geeksforgeeks.org/image-viewer-app-in-python-using-tkinter/ | # importing the tkinter module and PIL that
# is pillow module
from tkinter import *
from PIL import ImageTk, Image
# Calling the Tk (The initial constructor of tkinter)
root = Tk()
# We will make the title of our app as Image Viewer
root.title("Image Viewer")
# The geometry of the box which will be displayed
# on t... |
#Output : pip install tkinter | Image Viewer App in Python using Tkinter
# importing the tkinter module and PIL that
# is pillow module
from tkinter import *
from PIL import ImageTk, Image
# Calling the Tk (The initial constructor of tkinter)
root = Tk()
# We will make the title of our app as Image Viewer
root.title("Image Viewer")
# The geometry ... |
Image Viewer App in Python using Tkinter | https://www.geeksforgeeks.org/image-viewer-app-in-python-using-tkinter/ | def forward(img_no):
# GLobal variable so that we can have
# access and change the variable
# whenever needed
global label
global button_forward
global button_back
global button_exit
label.grid_forget()
# This is for clearing the screen so that
# our next image can pop up
la... |
#Output : pip install tkinter | Image Viewer App in Python using Tkinter
def forward(img_no):
# GLobal variable so that we can have
# access and change the variable
# whenever needed
global label
global button_forward
global button_back
global button_exit
label.grid_forget()
# This is for clearing the screen so th... |
Image Viewer App in Python using Tkinter | https://www.geeksforgeeks.org/image-viewer-app-in-python-using-tkinter/ | def back(img_no):
# We will have global variable to access these
# variable and change whenever needed
global label
global button_forward
global button_back
global button_exit
label.grid_forget()
# for clearing the image for new image to pop up
label = Label(image=List_images[img_no... |
#Output : pip install tkinter | Image Viewer App in Python using Tkinter
def back(img_no):
# We will have global variable to access these
# variable and change whenever needed
global label
global button_forward
global button_back
global button_exit
label.grid_forget()
# for clearing the image for new image to pop up
... |
Image Viewer App in Python using Tkinter | https://www.geeksforgeeks.org/image-viewer-app-in-python-using-tkinter/ | # importing the tkinter module and PIL
# that is pillow module
from tkinter import *
from PIL import ImageTk, Image
def forward(img_no):
# GLobal variable so that we can have
# access and change the variable
# whenever needed
global label
global button_forward
global button_back
global but... |
#Output : pip install tkinter | Image Viewer App in Python using Tkinter
# importing the tkinter module and PIL
# that is pillow module
from tkinter import *
from PIL import ImageTk, Image
def forward(img_no):
# GLobal variable so that we can have
# access and change the variable
# whenever needed
global label
global button_forw... |
Create GUI for Downloading Youtube Video using Python | https://www.geeksforgeeks.org/create-gui-for-downloading-youtube-video-using-python/ | # Importing necessary packages
import tkinter as tk
from tkinter import *
from pytube import YouTube
from tkinter import messagebox, filedialog
# Defining CreateWidgets() function
# to create necessary tkinter widgets
def Widgets():
head_label = Label(
root,
text="YouTube Video Downloader Using Tk... |
#Output : pip install pytube3 | Create GUI for Downloading Youtube Video using Python
# Importing necessary packages
import tkinter as tk
from tkinter import *
from pytube import YouTube
from tkinter import messagebox, filedialog
# Defining CreateWidgets() function
# to create necessary tkinter widgets
def Widgets():
head_label = Label(
... |
Create a GUI to extract Lyrics from song Using Python | https://www.geeksforgeeks.org/create-a-gui-to-extract-lyrics-from-song-using-python/ | # importing modules
from lyrics_extractor import SongLyrics
# pass the GCS_API_KEY, GCS_ENGINE_ID
extract_lyrics = SongLyrics("AIzaSewfsdfsdfOq0oTixw", "frewrewrfsac")
extract_lyrics.get_lyrics("Tujhse Naraz Nahi Zindagi Lyrics") |
#Output : pip install lyrics-extractor | Create a GUI to extract Lyrics from song Using Python
# importing modules
from lyrics_extractor import SongLyrics
# pass the GCS_API_KEY, GCS_ENGINE_ID
extract_lyrics = SongLyrics("AIzaSewfsdfsdfOq0oTixw", "frewrewrfsac")
extract_lyrics.get_lyrics("Tujhse Naraz Nahi Zindagi Lyrics")
#Output : pip install lyrics-ex... |
Create a GUI to extract Lyrics from song Using Python | https://www.geeksforgeeks.org/create-a-gui-to-extract-lyrics-from-song-using-python/ | # import modules
from tkinter import *
from lyrics_extractor import SongLyrics
# user defined function
def get_lyrics():
extract_lyrics = SongLyrics("Aerwerwefwdssdj-nvN3Oq0oTixw", "werwerewcxzcsda")
temp = extract_lyrics.get_lyrics(str(e.get()))
res = temp["lyrics"]
result.set(res)
# object of tki... |
#Output : pip install lyrics-extractor | Create a GUI to extract Lyrics from song Using Python
# import modules
from tkinter import *
from lyrics_extractor import SongLyrics
# user defined function
def get_lyrics():
extract_lyrics = SongLyrics("Aerwerwefwdssdj-nvN3Oq0oTixw", "werwerewcxzcsda")
temp = extract_lyrics.get_lyrics(str(e.get()))
res ... |
Application to get live USD/INR rate Using Python | https://www.geeksforgeeks.org/application-to-get-live-usd-inr-rate-using-python/ | # Import required modules
import requests
from bs4 import BeautifulSoup |
#Output : pip install bs4 | Application to get live USD/INR rate Using Python
# Import required modules
import requests
from bs4 import BeautifulSoup
#Output : pip install bs4
[END] |
Application to get live USD/INR rate Using Python | https://www.geeksforgeeks.org/application-to-get-live-usd-inr-rate-using-python/ | # Function to extract html data
def getdata(url):
r = requests.get(url)
return r.text |
#Output : pip install bs4 | Application to get live USD/INR rate Using Python
# Function to extract html data
def getdata(url):
r = requests.get(url)
return r.text
#Output : pip install bs4
[END] |
Application to get live USD/INR rate Using Python | https://www.geeksforgeeks.org/application-to-get-live-usd-inr-rate-using-python/ | # Extract and converthtmldata = getdata("https://finance.yahoo.com/quote/usdinr=X?ltr=1")soup = BeautifulSoup(htmldata, 'html.parser')result = (soup.find_all("div", class_="D(ib) Va(m) Maw(65%) Ov(h)") |
#Output : pip install bs4 | Application to get live USD/INR rate Using Python
# Extract and converthtmldata = getdata("https://finance.yahoo.com/quote/usdinr=X?ltr=1")soup = BeautifulSoup(htmldata, 'html.parser')result = (soup.find_all("div", class_="D(ib) Va(m) Maw(65%) Ov(h)")
#Output : pip install bs4
[END] |
Application to get live USD/INR rate Using Python | https://www.geeksforgeeks.org/application-to-get-live-usd-inr-rate-using-python/ | mydatastr = ""
# Filter converted data
for table in soup.find_all("div", class_="D(ib) Va(m) Maw(65%) Ov(h)"):
mydatastr += table.get_text()
# Display output
print(mydatastr) |
#Output : pip install bs4 | Application to get live USD/INR rate Using Python
mydatastr = ""
# Filter converted data
for table in soup.find_all("div", class_="D(ib) Va(m) Maw(65%) Ov(h)"):
mydatastr += table.get_text()
# Display output
print(mydatastr)
#Output : pip install bs4
[END] |
Application to get live USD/INR rate Using Python | https://www.geeksforgeeks.org/application-to-get-live-usd-inr-rate-using-python/ | # Import required modules
from tkinter import *
import requests
from bs4 import BeautifulSoup
# user defined function
# to extract currency details
def getdata(url):
r = requests.get(url)
return r.text
# Function to compute and display currency details
def get_info():
try:
htmldata = getdata("ht... |
#Output : pip install bs4 | Application to get live USD/INR rate Using Python
# Import required modules
from tkinter import *
import requests
from bs4 import BeautifulSoup
# user defined function
# to extract currency details
def getdata(url):
r = requests.get(url)
return r.text
# Function to compute and display currency details
def g... |
Build an Application for Screen Rotation Using Python | https://www.geeksforgeeks.org/build-an-application-for-screen-rotation-using-python/ | # Import required module
import rotatescreen |
#Output : pip install rotate-screen | Build an Application for Screen Rotation Using Python
# Import required module
import rotatescreen
#Output : pip install rotate-screen
[END] |
Build an Application for Screen Rotation Using Python | https://www.geeksforgeeks.org/build-an-application-for-screen-rotation-using-python/ | # Accessing the main screen
rotate_screen = rotatescreen.get_primary_display() |
#Output : pip install rotate-screen | Build an Application for Screen Rotation Using Python
# Accessing the main screen
rotate_screen = rotatescreen.get_primary_display()
#Output : pip install rotate-screen
[END] |
Build an Application for Screen Rotation Using Python | https://www.geeksforgeeks.org/build-an-application-for-screen-rotation-using-python/ | # Methods to change orientation
# for landscape
rotate_screen.set_landscape()
# portrait at left
rotate_screen.set_portrait_flipped()
# landscape at down
rotate_screen.set_landscape_flipped()
# portrait at right
rotate_screen.set_portrait() |
#Output : pip install rotate-screen | Build an Application for Screen Rotation Using Python
# Methods to change orientation
# for landscape
rotate_screen.set_landscape()
# portrait at left
rotate_screen.set_portrait_flipped()
# landscape at down
rotate_screen.set_landscape_flipped()
# portrait at right
rotate_screen.set_portrait()
#Output : pip inst... |
Build an Application for Screen Rotation Using Python | https://www.geeksforgeeks.org/build-an-application-for-screen-rotation-using-python/ | # Import required modules
from tkinter import *
import rotatescreen
# User defined function
# for rotating screen
def Screen_rotation(temp):
screen = rotatescreen.get_primary_display()
if temp == "up":
screen.set_landscape()
elif temp == "right":
screen.set_portrait_flipped()
elif temp... |
#Output : pip install rotate-screen | Build an Application for Screen Rotation Using Python
# Import required modules
from tkinter import *
import rotatescreen
# User defined function
# for rotating screen
def Screen_rotation(temp):
screen = rotatescreen.get_primary_display()
if temp == "up":
screen.set_landscape()
elif temp == "right... |
Text detection using Python | https://www.geeksforgeeks.org/text-detection-using-python/ | import time
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from tkinter import *
import tkinter.messagebox
from nltk.sentiment.vader import SentimentIntensityAnalyzer
class analysis_text:
# Main function in program
def center(self, toplevel):
toplevel.update_idletasks()
... |
#Output : conda install -c anaconda tk | Text detection using Python
import time
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from tkinter import *
import tkinter.messagebox
from nltk.sentiment.vader import SentimentIntensityAnalyzer
class analysis_text:
# Main function in program
def center(self, toplevel):
topleve... |
Make Notepad using Tkinter | https://www.geeksforgeeks.org/make-notepad-using-tkinter/ | import tkinter
import os
from tkinter import *
# To get the space above for message
from tkinter.messagebox import *
# To get the dialog box to open when required
from tkinter.filedialog import * |
#Output : pip install python-tk | Make Notepad using Tkinter
import tkinter
import os
from tkinter import *
# To get the space above for message
from tkinter.messagebox import *
# To get the dialog box to open when required
from tkinter.filedialog import *
#Output : pip install python-tk
[END] |
Make Notepad using Tkinter | https://www.geeksforgeeks.org/make-notepad-using-tkinter/ | # Add controls(widget)
self.__thisTextArea.grid(sticky=N + E + S + W)
# To open new file
self.__thisFileMenu.add_command(label="New", command=self.__newFile)
# To open a already existing file
self.__thisFileMenu.add_command(label="Open", command=self.__openFile)
# To save current file
self.__thisFileMenu.add_comman... |
#Output : pip install python-tk | Make Notepad using Tkinter
# Add controls(widget)
self.__thisTextArea.grid(sticky=N + E + S + W)
# To open new file
self.__thisFileMenu.add_command(label="New", command=self.__newFile)
# To open a already existing file
self.__thisFileMenu.add_command(label="Open", command=self.__openFile)
# To save current file
sel... |
Make Notepad using Tkinter | https://www.geeksforgeeks.org/make-notepad-using-tkinter/ | def __quitApplication(self):
self.__root.destroy()
# exit()
def __showAbout(self):
showinfo("Notepad", "Mrinal Verma")
def __openFile(self):
self.__file = askopenfilename(
defaultextension=".txt",
filetypes=[("All Files", "*.*"), ("Text Documents", "*.txt")],
)
if self.__fil... |
#Output : pip install python-tk | Make Notepad using Tkinter
def __quitApplication(self):
self.__root.destroy()
# exit()
def __showAbout(self):
showinfo("Notepad", "Mrinal Verma")
def __openFile(self):
self.__file = askopenfilename(
defaultextension=".txt",
filetypes=[("All Files", "*.*"), ("Text Documents", "*.txt")... |
Make Notepad using Tkinter | https://www.geeksforgeeks.org/make-notepad-using-tkinter/ | import tkinter
import os
from tkinter import *
from tkinter.messagebox import *
from tkinter.filedialog import *
class Notepad:
__root = Tk()
# default window width and height
__thisWidth = 300
__thisHeight = 300
__thisTextArea = Text(__root)
__thisMenuBar = Menu(__root)
__thisFileMenu = ... |
#Output : pip install python-tk | Make Notepad using Tkinter
import tkinter
import os
from tkinter import *
from tkinter.messagebox import *
from tkinter.filedialog import *
class Notepad:
__root = Tk()
# default window width and height
__thisWidth = 300
__thisHeight = 300
__thisTextArea = Text(__root)
__thisMenuBar = Menu(__... |
Create a GUI for Weather Forecast using openweathermap API in Python | https://www.geeksforgeeks.org/create-a-gui-for-weather-forecast-using-openweathermap-api-in-python/ | # python3 -- Weather Application using API
# importing the libraries
from tkinter import *
import requests
import json
import datetime
from PIL import ImageTk, Image
# necessary details
root = Tk()
root.title("Weather App")
root.geometry("450x700")
root["background"] = "white"
# Image
new = ImageTk.PhotoImage(Image... |
#Output : pip install requests | Create a GUI for Weather Forecast using openweathermap API in Python
# python3 -- Weather Application using API
# importing the libraries
from tkinter import *
import requests
import json
import datetime
from PIL import ImageTk, Image
# necessary details
root = Tk()
root.title("Weather App")
root.geometry("450x700")... |
Build a Voice Recorder GUI using Python | https://www.geeksforgeeks.org/build-a-voice-recorder-gui-using-python/ | import sounddevice as sd
import soundfile as sf
from tkinter import *
def Voice_rec():
fs = 48000
# seconds
duration = 5
myrecording = sd.rec(int(duration * fs), samplerate=fs, channels=2)
sd.wait()
# Save as FLAC file at correct sampling rate
return sf.write("my_Audio_file.flac", myreco... |
#Output : pip install sounddevice
| Build a Voice Recorder GUI using Python
import sounddevice as sd
import soundfile as sf
from tkinter import *
def Voice_rec():
fs = 48000
# seconds
duration = 5
myrecording = sd.rec(int(duration * fs), samplerate=fs, channels=2)
sd.wait()
# Save as FLAC file at correct sampling rate
retu... |
Create a Sideshow application in Python | https://www.geeksforgeeks.org/create-a-sideshow-application-in-python/ | # import required modules
import tkinter as tk
from tkinter import *
from PIL import Image
from PIL import ImageTk |
#Output : pip install Pillow
| Create a Sideshow application in Python
# import required modules
import tkinter as tk
from tkinter import *
from PIL import Image
from PIL import ImageTk
#Output : pip install Pillow
[END] |
Create a Sideshow application in Python | https://www.geeksforgeeks.org/create-a-sideshow-application-in-python/ | # adjust window
root = tk.Tk()
root.geometry("200x200")
# loading the images
img = ImageTk.PhotoImage(Image.open("photo1.png"))
img2 = ImageTk.PhotoImage(Image.open("photo2.png"))
img3 = ImageTk.PhotoImage(Image.open("photo3.png"))
l = Label()
l.pack() |
#Output : pip install Pillow
| Create a Sideshow application in Python
# adjust window
root = tk.Tk()
root.geometry("200x200")
# loading the images
img = ImageTk.PhotoImage(Image.open("photo1.png"))
img2 = ImageTk.PhotoImage(Image.open("photo2.png"))
img3 = ImageTk.PhotoImage(Image.open("photo3.png"))
l = Label()
l.pack()
#Output : pip install ... |
Create a Sideshow application in Python | https://www.geeksforgeeks.org/create-a-sideshow-application-in-python/ | # using recursion to slide to next image
x = 1
# function to change to next image
def move():
global x
if x == 4:
x = 1
if x == 1:
l.config(image=img)
elif x == 2:
l.config(image=img2)
elif x == 3:
l.config(image=img3)
x = x + 1
root.after(2000, move)
# ca... |
#Output : pip install Pillow
| Create a Sideshow application in Python
# using recursion to slide to next image
x = 1
# function to change to next image
def move():
global x
if x == 4:
x = 1
if x == 1:
l.config(image=img)
elif x == 2:
l.config(image=img2)
elif x == 3:
l.config(image=img3)
x =... |
Create a Sideshow application in Python | https://www.geeksforgeeks.org/create-a-sideshow-application-in-python/ | root.mainloop() |
#Output : pip install Pillow
| Create a Sideshow application in Python
root.mainloop()
#Output : pip install Pillow
[END] |
Create a Sideshow application in Python | https://www.geeksforgeeks.org/create-a-sideshow-application-in-python/ | # import required modules
import tkinter as tk
from tkinter import *
from PIL import Image
from PIL import ImageTk
# adjust window
root = tk.Tk()
root.geometry("200x200")
# loading the images
img = ImageTk.PhotoImage(Image.open("photo1.png"))
img2 = ImageTk.PhotoImage(Image.open("photo2.png"))
img3 = ImageTk.PhotoIm... |
#Output : pip install Pillow
| Create a Sideshow application in Python
# import required modules
import tkinter as tk
from tkinter import *
from PIL import Image
from PIL import ImageTk
# adjust window
root = tk.Tk()
root.geometry("200x200")
# loading the images
img = ImageTk.PhotoImage(Image.open("photo1.png"))
img2 = ImageTk.PhotoImage(Image.op... |
Visiting Card Scanner GUI Application using Python | https://www.geeksforgeeks.org/visiting-card-scanner-gui-application-using-python/ | # Visiting Card scanner GUI
# imported tkinter library
from tkinter import *
import tkinter.messagebox as tmsg
# Pillow library for importing images
from PIL import Image, ImageTk
# library for filedialog (For file selection)
from tkinter import filedialog
# Pytesseract module importing
import pytesseract
import os... |
#Output : pip install pytesseract | Visiting Card Scanner GUI Application using Python
# Visiting Card scanner GUI
# imported tkinter library
from tkinter import *
import tkinter.messagebox as tmsg
# Pillow library for importing images
from PIL import Image, ImageTk
# library for filedialog (For file selection)
from tkinter import filedialog
# Pytess... |
Create digital clock using Python-Turtle | https://www.geeksforgeeks.org/create-digital-clock-using-python-turtle/ | import time
import datetime as dt
import turtle
# create a turtle to display time
t = turtle.Turtle()
# create a turtle to create rectangle box
t1 = turtle.Turtle()
# create screen
s = turtle.Screen()
# set background color of the screen
s.bgcolor("green")
# obtain current hour, minute and second
# from the syste... |
#Output : pip install turtle | Create digital clock using Python-Turtle
import time
import datetime as dt
import turtle
# create a turtle to display time
t = turtle.Turtle()
# create a turtle to create rectangle box
t1 = turtle.Turtle()
# create screen
s = turtle.Screen()
# set background color of the screen
s.bgcolor("green")
# obtain current... |
Draw a Tic Tac Toe Board using Python-Turtle | https://www.geeksforgeeks.org/draw-a-tic-tac-toe-board-using-python-turtle/ | import turtle
# getting a Screen to work on
ws = turtle.Screen()
# Defining Turtle instance
t = turtle.Turtle()
# setting up turtle color to green
t.color("Green")
# Setting Up width to 2
t.width("2")
# Setting up speed to 2
t.speed(2)
# Loop for making outside square of
# length 300
for i in range(4):
t.for... |
#Output : import turtle | Draw a Tic Tac Toe Board using Python-Turtle
import turtle
# getting a Screen to work on
ws = turtle.Screen()
# Defining Turtle instance
t = turtle.Turtle()
# setting up turtle color to green
t.color("Green")
# Setting Up width to 2
t.width("2")
# Setting up speed to 2
t.speed(2)
# Loop for making outside square... |
How to make Indian Flag using Turtle - | https://www.geeksforgeeks.org/how-to-make-indian-flag-using-turtle-python/ | import turtle
from turtle import *
# screen for output
screen = turtle.Screen()
# Defining a turtle Instance
t = turtle.Turtle()
speed(0)
# initially penup()
t.penup()
t.goto(-400, 250)
t.pendown()
# Orange Rectangle
# white rectangle
t.color("orange")
t.begin_fill()
t.forward(800)
t.right(90)
t.forward(167)
t.righ... |
#Output : import turtle | How to make Indian Flag using Turtle -
import turtle
from turtle import *
# screen for output
screen = turtle.Screen()
# Defining a turtle Instance
t = turtle.Turtle()
speed(0)
# initially penup()
t.penup()
t.goto(-400, 250)
t.pendown()
# Orange Rectangle
# white rectangle
t.color("orange")
t.begin_fill()
t.forw... |
Displaying the coordinates of the points clicked on the image using Python-OpenCV | https://www.geeksforgeeks.org/displaying-the-coordinates-of-the-points-clicked-on-the-image-using-python-opencv/ | # importing the module
import cv2
# function to display the coordinates of
# of the points clicked on the image
def click_event(event, x, y, flags, params):
# checking for left mouse clicks
if event == cv2.EVENT_LBUTTONDOWN:
# displaying the coordinates
# on the Shell
print(x, " ", y)
... |
#Output : import cv2
| Displaying the coordinates of the points clicked on the image using Python-OpenCV
# importing the module
import cv2
# function to display the coordinates of
# of the points clicked on the image
def click_event(event, x, y, flags, params):
# checking for left mouse clicks
if event == cv2.EVENT_LBUTTONDOWN:
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.