0% found this document useful (0 votes)
6 views6 pages

Advanced Python Class - 3

The document contains Python programs for a GUI application with three pages using Tkinter, allowing navigation between them. It also includes a program for sending emails using the smtplib library, featuring a simple user interface for entering recipient addresses and message content. The code snippets demonstrate basic functionalities such as page transitions and email sending capabilities.

Uploaded by

nazar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views6 pages

Advanced Python Class - 3

The document contains Python programs for a GUI application with three pages using Tkinter, allowing navigation between them. It also includes a program for sending emails using the smtplib library, featuring a simple user interface for entering recipient addresses and message content. The code snippets demonstrate basic functionalities such as page transitions and email sending capabilities.

Uploaded by

nazar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

TECHMIND INFOTECH

Computer Education and Project Training Centre


(A Government Approved Institution)
Sri Ram Towers 2nd Floor, Santhanathapuram 6th Street, Pudukkottai
Cell: 7293 52 7293 Email: [email protected]
ADVANCED PYTHON CLASS - 3

// PYTHON PROGRAM - PAGE1.PY


from tkinter import *

ws = Tk()

ws.geometry('400x300')

ws.title('PythonGuides')

ws['bg']='#5d8a82'

f = ("Times bold", 14)

def nextPage():

ws.destroy()

import page2

def prevPage():

ws.destroy()

import page3

Label(

ws,

text="This is First page",

bg='#5d8a82',

font=f

).pack(expand=True)

Button(
ws,

text="Previous Page",

font=f,

command=prevPage

).pack(fill=X, expand=TRUE, side=LEFT)

Button(

ws,

text="Next Page",

font=f,

command=nextPage

).pack(fill=X, expand=TRUE, side=LEFT)

ws.mainloop()

// PYTHON PROGRAM - PAGE2.PY

from tkinter import *

ws = Tk()

ws.geometry('400x300')

ws.title('PythonGuides')

ws['bg']='#ffbf00'

f = ("Times bold", 14)

def nextPage():

ws.destroy()

import page3

def prevPage():

ws.destroy()

import page1
Label(

ws,

text="This is Second page",

bg='#ffbf00',

font=f

).pack(expand=True)

Button(

ws,

text="Previous Page",

font=f,

command=prevPage

).pack(fill=X,expand=TRUE, side=LEFT)

Button(

ws,

text="Next Page",

font=f,

command=nextPage

).pack(fill=X,expand=TRUE, side=LEFT)

ws.mainloop()

// PYTHON PROGRAM - PAGE3.PY

from tkinter import *

ws = Tk()

ws.geometry('400x300')

ws.title('PythonGuides')

ws['bg']='#ffbf00'
f = ("Times bold", 14)

def nextPage():

ws.destroy()

import page1

def prevPage():

ws.destroy()

import page2

Label(

ws,

text="This is Third page",

font = f,

bg='#bfff00'

).pack(expand=True)

Button(

ws,

text="Previous Page",

font=f,

command=nextPage

).pack(fill=X, expand=TRUE, side=LEFT)

Button(

ws,

text="Next Page",

font = f,

command=prevPage

).pack(fill=X, expand=TRUE, side=LEFT)

ws.mainloop()
PYTHON PROGRM FOR SENDING EMAIL

import smtplib

from tkinter import *

def send_message():

address_info = address.get()

email_body_info = email_body.get()

print(address_info,email_body_info)

sender_email = "[email protected]"

sender_password = "mohmoh_1"

server = smtplib.SMTP('smtp.gmail.com',587)

server.starttls()

server.login(sender_email,sender_password)

print("Login successful")

server.sendmail(sender_email,address_info,email_body_info)

print("Message sent")

address_entry.delete(0,END)

email_body_entry.delete(0,END)

app = Tk()

app.geometry("500x500")

app.title("Python Mail Send App")

heading = Label(text="Python Email Sending


App",bg="yellow",fg="black",font="10",width="500",height="3")

heading.pack()

address_field = Label(text="Recipient Address :")

email_body_field = Label(text="Message :")


address_field.place(x=15,y=70)

email_body_field.place(x=15,y=140)

address = StringVar()

email_body = StringVar()

address_entry = Entry(textvariable=address,width="30")

email_body_entry = Entry(textvariable=email_body,width="30")

address_entry.place(x=15,y=100)

email_body_entry.place(x=15,y=180)

button = Button(app,text="Send
Message",command=send_message,width="30",height="2",bg="grey")

button.place(x=15,y=220)

mainloop()

You might also like