Akshay Puniya Presentation On The Topic of Python
Akshay Puniya Presentation On The Topic of Python
root=Tk()
state=''
pygame.mixer.init()
def update():
pos=pygame.mixer.music.get_pos()/1000
prg['value']=(pos/music_length)*100
root.after(1000,update)
def playm():
global state
global music_length
file1=filedialog.askopenfilename()
pygame.mixer.music.load(file1)
music_length=pygame.mixer.Sound(file1).get_length()
pygame.mixer.music.play()
state='playing'
update()
def stopm():
pygame.mixer.music.stop()
def pausem():
global state
if (state=='playing'):
pygame.mixer.music.pause()
b2['text']='unpause'
state='pause'
elif (state=='pause'):
pygame.mixer.music.unpause()
b2['text']='pause'
state='playing'
b=Button(text="play",command=playm)
b.pack()
b1=Button(text="stop",command=stopm)
b1.pack()
b2=Button(text="pause",command=pausem)
b2.pack()
prg=Progressbar(value=70)
prg.pack(side='bottom',fill='x')
root.mainloop()
Python code that shows time on
your device
from tkinter import *
root = Tk()
def update():
l['text']=strftime('%H:%M:%S %p')
l=Label(bg="black",fg="white",font=("Arial",20,"bold"))
l.pack()
update()
root.mainloop()
root = Tk()
turn=1
def winner():
if (buttons[0]['text']==buttons[4]['text']==buttons[8]['text']!=''or
buttons[2]['text']==buttons[4]['text']==buttons[6]['text']!=''or
buttons[0]['text']==buttons[1]['text']==buttons[2]['text']!=''or
buttons[3]['text']==buttons[4]['text']==buttons[5]['text']!=''or
buttons[6]['text']==buttons[7]['text']==buttons[8]['text']!=''or
buttons[0]['text']==buttons[3]['text']==buttons[6]['text']!=''or
buttons[1]['text']==buttons[4]['text']==buttons[7]['text']!=''or
buttons[2]['text']==buttons[5]['text']==buttons[8]['text']!=''):
if turn%2==0:
messagebox.showinfo("Success","User 2 wins")
#print("user 2 wins")
else:
messagebox.showinfo("Success","User 1 wins")
#print("user 1 wins")
def click(pos):
global turn
if buttons[pos]['text']=='':
if turn %2==0:
buttons[pos]['text']='X'
buttons[pos]['bg']='blue'
winner()
else:
buttons[pos]['text']='O'
buttons[pos]['bg']='red'
winner()
turn+=1
#print("hello",pos)
buttons=[]
for i in range(0,3):
for j in range(0,3):
b.grid(row=i,column=j)
buttons.append(b )
print(buttons)
root.mainloop()
rock paper & scissor
import random
import tkinter as tk
def game(user):
li = ["rook","peper","scissor"]
while True:
n2 = random.choice(li)
if user == n2:
print(f"{user} == {n2}")
elif user == "rook" and n2 == "scissor" or user == "peper" and n2 == "rook" or user == "scissor" and
n2 == "peper" :
root1 = tk.Tk()
root1.title("calculater")
root1.geometry("400x400")
# paper["bg"] = +e.get()
break
else:
root1 = tk.Tk()
root1.title("calculater")
root1.geometry("400x400")
break
# create window
root = tk.Tk()
root.geometry("400x400")
# btn 1 rook
rook.grid(row=4, column=3)
# btn 2 paper
paper.grid(row=4, column=6)
# btn 3 scissor
scissor.grid(row=4, column=9)
root.mainloop()
In conclusion, Python's simplicity, versatility, and powerful features make it an ideal choice for both
beginners and experienced developers. Its clean syntax and readability ensure a smooth learning curve,
while its extensive libraries and community support provide robust tools for various applications, from
web development to data science and artificial intelligence. Python's ability to integrate with other
technologies and its high demand in the job market further solidify its position as one of the best
programming languages available today.
By embracing Python, you open the door to endless opportunities and a bright future in the world of
programming. Thank you for your attention, and I hope this presentation has highlighted why Python
stands out as a remarkable and invaluable tool in the tech industry.
Piso Informatics Pvt. Ltd. is an IT company based in Mohali, Punjab, speciali ing in providing comprehensive ERP solutions,
custom so ware development, website development, web services, and networking solutions. They focus on delivering- user
friendly, high-performance solutions to streamline business processes across various industries, including finance, educati
nd on, a
healthcare. ith a proactive approach to understanding and meeting client needs,
Piso Informatics o ers robust technical
support to ensure the e ective implementation and maintenance of their services.
The vision of a omputer Engineering epartment typically aims to produce highly skilled professionals who
can contribute to the industry and research organi ations at both national and international levels. It focuses
on providing a strong theoretical and practical background, emphasi ing so ware development, innovation,
and leadership abilities. The goal is to empower students with the knowledge and skills needed to excel in
their careers and make significant contributions to society.