Friday, February 12, 2021

day 35 table widget and text widget

from tkinter import * import pymysql def create_table(): conn=pymysql.connect(host="localhost",user="root",password="",db="sslabs") mycursor=conn.cursor() print("inside create table") #mycursor.execute("CREATE TABLE hotel (id INT AUTO_INCREMENT PRIMARY KEY, dosa VARCHAR(255), add VARCHAR(255), idle VARCHAR(255) )") #sql = "INSERT INTO hotel (dosa, idle, add) VALUES (%s, %s, %s)" mycursor.execute("CREATE TABLE hotel (id INT AUTO_INCREMENT PRIMARY KEY, dosa VARCHAR(255),idle VARCHAR(255), sum VARCHAR(255))") #1234514532 #sub=e3.get() #val = (dosa1, idle1) #mycursor.execute(sql, val) conn.commit() print(mycursor.rowcount, "record inserted.") def display(): #create_table() conn=pymysql.connect(host="localhost",user="root",password="",db="sslabs") mycursor=conn.cursor() #print("First Name: %s\nstandard:%s\nsubject:%s" % (e1.get(),e2.get(),e3.get())) #query = "SELECT * FROM student" ## getting records from the table #mycursor.execute(query) ## fetching all records from the 'cursor' object #records = mycursor.fetchall() ## Showing the data #for record in records: #print(record) a=e1.get() a=int(a) print(type(a)) b=e2.get() b=int(b) print(type(b)) sql = "INSERT INTO hotel (dosa, idle,sum) VALUES (%s, %s,%s)" c=a+b #sub=e3.get() val = (a,b,c) mycursor.execute(sql, val) Label(praveen , text=a).grid(row=5) conn.commit() praveen=Tk() #root=Tk() praveen.geometry("500x300") #root.geometry("500x300") praveen.title("Hotel management") #root.title("Hostel management") Label(praveen, text="dosa").grid(row=0) Label(praveen , text="idle").grid(row=1) e1=Entry(praveen) name=e1.grid(row=0,column=1) #e3=Entry(root) #name=e3.grid(row=0,column=1) e2=Entry(praveen) standard = e2.grid(row=1,column=1) Button(praveen,text='Quit', command=praveen.quit).grid(row=2,column=0,sticky=W,pady=4) Button(praveen,text='display', command=display).grid(row=2,column=1,sticky=W,pady=4) #Button(praveen,text='Insert', command=create_table).grid(row=2,column=2,sticky=W,pady=4) mainloop() # -*- coding: utf-8 -*- """ Created on Thu Feb 11 22:45:50 2021 @author: Onyx1 """ from tkinter import * import pymysql root = Tk() # specify size of window. root.geometry("250x170") # Create text widget and specify size. T = Text(root, height = 5, width = 52) T.pack() # Create label l = Label(root, text = "Fact of the Day") l.config(font =("Courier", 14)) l.pack() Fact = """A man can be arrested in Italy for wearing a skirt in public.""" # Create button for next text. b1 = Button(root, text = "Next", ) b1.pack() # Create an Exit button. b2 = Button(root, text = "Exit", command = root.destroy) b2.pack() # Inserroot The Fact. #root.insert(root.END, Fact) root.mainloop()

day 36 menu bar using python

#from tkinter import Toplevel, Button, Tk, Menu ,Label from tkinter import * top = Tk() def display_text(): w = Label(top,text="Hello Tkinter") #new_win=Tk() #new_win.geometry("300*400") w.pack() menubar = Menu(top) file = Menu(menubar, tearoff=0) file.add_command(label="New",command=display_text) file.add_command(label="Open") file.add_command(label="Save") file.add_command(label="Save as...") file.add_separator() file.add_command(label="print") file.add_command(label="print preview") file.add_command(label="Close") file.add_command(label="Exit", command=top.quit) menubar.add_cascade(label="File", menu=file) edit = Menu(menubar, tearoff=0) edit.add_command(label="Undo") edit.add_command(label="Cut") edit.add_command(label="Copy") edit.add_command(label="Paste") edit.add_separator() edit.add_command(label="Delete") edit.add_command(label="Select All") menubar.add_cascade(label="Edit", menu=edit) help = Menu(menubar, tearoff=0) help.add_command(label="About") menubar.add_cascade(label="Help", menu=help) view = Menu(menubar, tearoff=0) view.add_command(label="View") menubar.add_cascade(label="View", menu=view) top.config(menu=menubar) top.mainloop()

Thursday, February 11, 2021

pandas table with dictionary

df = pd.DataFrame( { "Name": [ "Braund, Mr. Owen Harris", "Allen, Mr. William Henry", "Bonnell, Miss. Elizabeth", ], "Age": [22, 35, 58], "Sex": ["male", "male", "female"], } ) print(df) output: Name Age Sex 0 Braund, Mr. Owen Harris 22 male 1 Allen, Mr. William Henry 35 male 2 Bonnell, Miss. Elizabeth 58 female

pandas in python

Tuesday, February 9, 2021

python day 34 tkinter with mysql connection


from tkinter import*

import pymysql



def create_table():

    conn=pymysql.connect(host="localhost",user="root",password="",db="sslabs")

    mycursor=conn.cursor()

    mycursor.execute("CREATE TABLE hotel (id INT AUTO_INCREMENT PRIMARY KEY, dosa VARCHAR(255),idle VARCHAR(255))")

    sql = "INSERT INTO hotel (dosa, idle) VALUES (%s, %s)"

   

    #sub=e3.get()

    #val = (dosa1, idle1)

    #mycursor.execute(sql, val)

    conn.commit()

    print(mycursor.rowcount, "record inserted.")


def show_entry_fields():

    #create_table()

    conn=pymysql.connect(host="localhost",user="root",password="",db="sslabs")

    mycursor=conn.cursor()

    #print("First Name: %s\nstandard:%s\nsubject:%s" % (e1.get(),e2.get(),e3.get()))

    #query = "SELECT * FROM student"

    ## getting records from the table

    #mycursor.execute(query)

    ## fetching all records from the 'cursor' object

    #records = mycursor.fetchall()

    ## Showing the data

    #for record in records:

        #print(record)

    a=e1.get()

    print(a)

    b=e2.get()

    print(b)

    sql = "INSERT INTO hotel (dosa, idle) VALUES (%s, %s)"

   

    #sub=e3.get()

    val = (a, b)

    mycursor.execute(sql, val)

    

    conn.commit()

    

    


praveen=Tk()

praveen.geometry("500x300")

praveen.title("Hotel management")



Label(praveen, text="dosa").grid(row=0)

Label(praveen , text="idle").grid(row=1)



e1=Entry(praveen)

name=e1.grid(row=0,column=1)



e2=Entry(praveen)

standard = e2.grid(row=1,column=1)



Button(praveen,text='Quit', command=praveen.quit).grid(row=2,column=0,sticky=W,pady=4)

Button(praveen,text='Show', command=show_entry_fields).grid(row=2,column=1,sticky=W,pady=4)

#Button(praveen,text='Insert', command=create_table).grid(row=2,column=2,sticky=W,pady=4)



mainloop()

tab widget python tkinter

     



import tkinter as tk  

from tkinter import ttk 



root = tk.Tk() 

root.title("Tab Widget") 

tabControl = ttk.Notebook(root) 


tab1 = ttk.Frame(tabControl) 

tab2 = ttk.Frame(tabControl) 

tab3 = ttk.Frame(tabControl) 


tabControl.add(tab1, text ='Tab 1') 

tabControl.add(tab2, text ='Tab 2') 

tabControl.add(tab3, text ='Tab 3') 

tabControl.pack() 


ttk.Label(tab1,text ="evening class").grid(column = 0, 

row = 0, 

padx = 30, 

pady = 62) 

ttk.Label(tab2, 

text ="praveen is thopu").grid(column = 0, 

row = 0, 

padx = 30, 

pady = 100) 

                                 

ttk.Label(tab3, 

text ="chiranjivi is thopu").grid(column = 0, 

row = 0, 

padx = 30, 

pady = 100) 


root.mainloop() 


Friday, February 5, 2021

python day 31 tkinter entery widget

 


"""

from tkinter import *


root = Tk()

root.title("Basic Entry Widget")



lbl=Label(root, text="This is Label widget", fg='red', font=("Helvetica", 16))

lbl.place(x=60, y=50)

ent = Entry(root)#same like input

ent.pack()#particular window



ent1 = Entry(root)#same like input

ent1.pack()#particular window


ent2 = Entry(root)#same like input

ent2.pack()#particular window



def show_data():

    print(ent.get())

    print(ent1.get())

    print(ent2.get())

    

    

Button(root,text="Show ",command=show_data).pack()


root.mainloop()




#multiple windows


from tkinter import *

root = Tk()

root1 = Tk()


data = "Hotel Management"


w = Label(root1,fg='white', bg='green',text=data,font=("Helvetica", 30))

w.pack()



root.mainloop()



from tkinter import *

root = Tk()



data = "Hotel Management"


w = Label(root,fg='RED', bg='green',text="Hotel Management",font=("calibri", 30))

w.pack()



root.mainloop()

"""






from tkinter import *

root = Tk()

root.title("Radio Button")


Label(root,text="Select True or False",justify=LEFT).pack()



data = BooleanVar()


def data_print():

    print(data.get())


true_button = Radiobutton(root,

                          text = "Ture",

                          variable=data,

                          value= True,

                          padx=20,

                          pady=5,

                          command = data_print

                          )


false_button = Radiobutton(root,

                           text = "False",

                           variable=data,

                           value= False,

                           padx=20,

                           pady=5,

                           command = data_print

                          )

true_button.pack()

false_button.pack()


root.mainloop()


























Wednesday, February 3, 2021

python day 31 tkinter button with command function

 import tkinter

from tkinter import *


def display():

    print("this is praveen")

    print("this is working")

    

def calculate():

    print(5*10)


main_windows=tkinter.Tk()

main_windows.geometry("800x500")

main_windows.title("Hotel management")


name_Label=Label(main_windows , text="Hotel Management", font=("arial", 40))

name_Label.place(x=500,y=10)


btn=Button(main_windows, text="Display", fg='red', command=display)

btn.place(x=20, y=20)



btn=Button(main_windows, text="calculate", fg='red', command=calculate)

btn.place(x=80, y=20)

main_windows.mainloop()

Sunday, January 31, 2021

EC25 Quectel drivers | QUECOPEN

After doing different projects on different micro controller i started working with Quectel EC25 driver( 4g LTE) and mc60 and m66.

 EC25 Quectel Drivers Description:

Quectel EC25 is a series of LTE Cat 4 module optimized specially for M2M and IoT applications. Adopting the 3GPP Rel. 11 LTE technology, it delivers 150Mbps downlink and 50Mbps uplink data rates. Designed in the compact and unified form factor,EC25 is compatible with Quectel UMTS/HSPA+ UC20/UC200T modules and multi-mode LTE EC2x/EG25-G modules, whichallows for flexible migration among them in design and manufacturing.EC25 contains 12 variants: EC25-E, EC25-EU, EC25-EC, EC25-EUX, EC25-A, EC25-V, EC25-AF, EC25-MX, EC25-AU, EC25-AUT,EC25-AUTL and EC25-J.

This makes it backward-compatible with existing EDGE and GSM/GPRS networks, ensuring that it can be connected even in remote areas devoid of 4G or 3G coverage.
EC25 supports Qualcomm® IZat™ location technology Gen8C Lite (GPS, GLONASS, BeiDou, Galileo and QZSS). The integrated GNSS greatly simplifies product design, and provides quicker, more accurate and more dependable positioning.

A rich set of Internet protocols, industry-standard interfaces and abundant functionalities (USB serial drivers for Windows 7/8/8.1/10, Linux, Android/eCall*) extend the applicability of the module to a wide range of M2M and IoT applications such as industrial router, industrial PDA, rugged tablet PC, video surveillance, and digital signage.

EC25 ubuntu os link for virtual machine

download the above link 


EC25 Quectel driver


python day 29 tkinter class1

 # -*- coding: utf-8 -*-

"""

Created on Mon Feb  1 07:09:50 2021


@author: anil



import tkinter


window=tkinter.Tk()

window.geometry("1024x768")

window.mainloop()




import tkinter


window=tkinter.Tk()

window.geometry("1920x1080")

window.mainloop()


import tkinter

#from tkinter import *


window=tkinter.Tk()

window.geometry("1920x1080")

Button(window,text='Quit', command=master.quit)

window.mainloop()

"""



from tkinter import *

import pymysql



def create_table():

    conn=pymysql.connect(host="localhost",user="root",password="",db="sslabs")

    mycursor=conn.cursor()

    #mycursor.execute("CREATE TABLE student2 (id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255),standard VARCHAR(255), sub VARCHAR(255) )")

    sql = "INSERT INTO student2 (name, standard,sub) VALUES (%s, %s,%s)"

 

    #print("First Name: %s\nstandard:%s\nsubject:%s" % (e1.get(),e2.get(),e3.get()))

    name=e1.get()

    standard=e2.get()

    sub=e3.get()

    val = (name, standard, sub)

    mycursor.execute(sql, val)

    conn.commit()

    print(mycursor.rowcount, "record inserted.")


def show_entry_fields():

    #print("First Name: %s\nstandard:%s\nsubject:%s" % (e1.get(),e2.get(),e3.get()))

    query = "SELECT * FROM student2"

    ## getting records from the table

    mycursor.execute(query)

    ## fetching all records from the 'cursor' object

    records = mycursor.fetchall()

    ## Showing the data

    for record in records:

        print(record)


master=Tk()

master.geometry("500x300")

master.title("Hotel management")



Label(master , text="dosa").grid(row=0)

Label(master , text="idle").grid(row=1)

Label(master , text="puri").grid(row=2)

Label(master , text="wada").grid(row=3)

Label(master , text="Bonda").grid(row=4)

Label(master , text="Upma").grid(row=5)


e1=Entry(master)

name=e1.grid(row=0,column=1)

e2=Entry(master)

standard = e2.grid(row=1,column=1)

e3=Entry(master)

sub = e3.grid(row=2,column=1)


Button(master,text='Quit', command=master.quit).grid(row=6,column=0,sticky=W,pady=4)

Button(master,text='Show', command=show_entry_fields).grid(row=7,column=1,sticky=W,pady=4)

Button(master,text='Insert', command=create_table).grid(row=8,column=2,sticky=W,pady=4)



mainloop()






python day 28 mysql with python crud operations

 # -*- coding: utf-8 -*-

"""

Created on Sun Jan 31 13:29:32 2021


@author:anil




#try fail condition

try:

   print("i am in try")

   

#error handling

except:

    print("i am in expect block")

   

    


#try fail condition

try:

   print(1/0)

   #failing condition

   

#error handling

except:

    print("i am in except block")



   

#try fail condition

try:

   #print("db conneted")

   print(1/0)

   #db connections

   #failing condition

   

#error handling

except ZeroDivisionError:

    print("this is name ZeroDivisionError: block")


try:

   #print("db conneted")

   print(1/1)

   #db connections

   #failing condition

   

#error handling

except ZeroDivisionError:

    print("this is name ZeroDivisionError: block")

else:

    print("nothing is wrong")

 

  

try:

   #print("db conneted")

    while(1):

        print(1/1)

   #db connections

   #failing condition

   

#error handling

except ZeroDivisionError:

    print("this is name ZeroDivisionError: block")

finally:

    print("finally class")


try:

   #print("db conneted")

   for i in range(10):

       print(1/1)

    

   print(1/0)

   #db connections

   #failing condition

   

#error handling

except ZeroDivisionError:

    print("this is name ZeroDivisionError: block")

finally:

    print("finally class")


    

    

try:

   f = open("mytesfd.txt",'r+b')

   f.write("this is testing")

except:

    raise Exception("sorry file is missing")

finally:

    f.close()

   


try:

   print("this is connected")


finally:

    print("file closed")


    

    

import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor()

ycursor.execute(CREATE TABLE fifth_class_a (id int primary key, name varchar(20),last_name varchar(20)))

mycursor.execute(CREATE TABLE fifth_class_b (id int primary key, name varchar(20)))

mycursor.execute(CREATE TABLE fifth_class_b (id int primary key, name varchar(20)))

conn.commit()

conn.close()


import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor()


mycursor.execute(CREATE TABLE fifth_class_d (id int primary key, name varchar(20),lastname varchar(20),student_id varchar(20)))

conn.commit()

conn.close()



import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor()

#mycursor.execute("INSERT INTO names(id,name) VALUES(1,'praveen');")

#a=mycursor.execute("INSERT INTO names(id,name) VALUES(4,'lavanya');")


#print("->data inserted")


 

mycursor.execute("UPDATE `names` SET `name` = 'lavanya2' WHERE `names`.`id` = 4;")


mycursor.execute("SELECT * FROM names")

row = mycursor.fetchone()

while row is not None:

    print(row)

    row = mycursor.fetchone()


conn.commit()

conn.close()


#CRUD

#C-create

#R-read

#U-update

#D-delete



#update the tables

import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor() 

mycursor.execute("UPDATE `names` SET `name` = 'laxmi' WHERE `names`.`id` = 4;")


conn.commit()

conn.close()




#delete operation

import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor() 

mycursor.execute("DELETE FROM `names`  WHERE `id` = 4;")


conn.commit()

conn.close()




import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor() 

#mycursor.execute("DELETE FROM `names`  WHERE `id` = 4;")

sql_select_Query = "select * from names"

mycursor.execute(sql_select_Query)

records = mycursor.fetchall()


for row in records:

        print("Id = ", row[0], )

        print("Name = ", row[1])

        

        

        

conn.commit()

conn.close()


"""


import pymysql


conn=pymysql.connect(host="localhost",user="root",password="",db="praveen_test")

mycursor=conn.cursor() 

#mycursor.execute("DELETE FROM `names`  WHERE `id` = 4;")

sql_select_Query = "select * from names"

mycursor.execute(sql_select_Query)

records = mycursor.fetchall()


for row in records:

        print("Name = ", row[1])


conn.commit()

conn.close()





    

    


python class topic video