embedded system,Arduino,Raspberry pi,ARM7,MM32,STM32,PIC and Python,Django,Datascience and web development
Friday, February 12, 2021
day 35 table widget and text widget
day 36 menu bar using python
Thursday, February 11, 2021
pandas table with dictionary
pandas in python
import pandas as pd
data = pd.read_csv("http://bit.ly/imdbratings")
data
star_rating | title | content_rating | genre | duration | actors_list | |
---|---|---|---|---|---|---|
0 | 9.3 | The Shawshank Redemption | R | Crime | 142 | [u'Tim Robbins', u'Morgan Freeman', u'Bob Gunt... |
1 | 9.2 | The Godfather | R | Crime | 175 | [u'Marlon Brando', u'Al Pacino', u'James Caan'] |
2 | 9.1 | The Godfather: Part II | R | Crime | 200 | [u'Al Pacino', u'Robert De Niro', u'Robert Duv... |
3 | 9.0 | The Dark Knight | PG-13 | Action | 152 | [u'Christian Bale', u'Heath Ledger', u'Aaron E... |
4 | 8.9 | Pulp Fiction | R | Crime | 154 | [u'John Travolta', u'Uma Thurman', u'Samuel L.... |
... | ... | ... | ... | ... | ... | ... |
974 | 7.4 | Tootsie | PG | Comedy | 116 | [u'Dustin Hoffman', u'Jessica Lange', u'Teri G... |
975 | 7.4 | Back to the Future Part III | PG | Adventure | 118 | [u'Michael J. Fox', u'Christopher Lloyd', u'Ma... |
976 | 7.4 | Master and Commander: The Far Side of the World | PG-13 | Action | 138 | [u'Russell Crowe', u'Paul Bettany', u'Billy Bo... |
977 | 7.4 | Poltergeist | PG | Horror | 114 | [u'JoBeth Williams', u"Heather O'Rourke", u'Cr... |
978 | 7.4 | Wall Street | R | Crime | 126 | [u'Charlie Sheen', u'Michael Douglas', u'Tamar... |
979 rows × 6 columns
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()
-
How to do the programming python in windows command prompt Step 1: please go through below link website f...
-
Serial.print() Description Prints data to the serial port as human-readable ASCII text. This command can take many forms. Numbers a...