Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions Basic-Scripts/Queue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from os import sys
class Queue(object):
def __init__(self):
self.array=[]
self.top=0
self.rear=0

def isEmpty(self):
return self.array==[]

def push(self,item):
self.array.insert(0,item)
self.rear+=1

def pop(self):
self.array.pop()
self.rear-=1

def menu(self):
char=0
while char<6:
print("Press 1 -> To add a element to the Queue")
print("Press 2 -> To remove a element from the Queue")
print("Press 3 -> To view the top and rear element of the Queue")
print("Press 4 -> To view all the elements of the Queue")
print("Press 5 -> To Exit")
char=int(input("Enter your choice: "))
print('\n')
if char==1:
val=int(input("Enter the element: "))
self.push(val)
print("Your element has been added.")
print('\n')
elif char==2:
if self.isEmpty():
print("Queue is underflowed. Please add elements to it.")
break
else:
self.pop()
print("Your element has been removed")
print('\n')
elif char==3:
print("Top element -> {}".format(self.array[self.top]))
print("Rear element -> {}".format(self.array[self.rear-1]))
print('\n')
elif char==4:
for i in range(0,len(self.array)):
if i==len(self.array) - 1:
print("{} <- Rear Element".format(self.array[i]))
elif i==0:
print("{} <- Top Element".format(self.array[0]))
else:
print(self.array[i])
print('\n')
else:
sys.exit()

Object1=Queue()
Object1.menu()


8 changes: 8 additions & 0 deletions System-Automation-Scripts/Translator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
##PYTHON GUI TRANSLATOR

#Before running the program, install the following libraries:
*googletrans
*pillow
(Install using pip command)

#The *translator.png* is the logo for the GUI application.
83 changes: 83 additions & 0 deletions System-Automation-Scripts/Translator/google_translator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
from tkinter import *
import tkinter as tk
from tkinter import ttk
from PIL import ImageTk, Image #pip3 install pillow
from googletrans import Translator #pip3 install googletrans
from tkinter import messagebox

root = tk.Tk()
root.title('Langauge Translator')
root.geometry('550x400')
root.maxsize(550,400)
root.minsize(550,400)


def translate(): #to_translate
language_1 = t1.get("1.0","end-1c")
cl = choose_langauge.get()

if language_1 == '':
messagebox.showerror('Language Translator','please fill the box')
else:
translator = Translator()
output = translator.translate(language_1, dest=cl)
t2.insert('end',output.text)

def clear(): #to clear the area
t1.delete(1.0,'end')
t2.delete(1.0,'end')


#top logo and design

img = ImageTk.PhotoImage(Image.open('translator.png'))
label = Label(image=img)
label.place(x=230,y=3)


a = tk.StringVar()
auto_detect = ttk.Combobox(root, width = 20, textvariable = a, state='readonly',font=('verdana',10,'bold'),)



auto_detect['values'] = ('Auto Detect',)

auto_detect.place(x=30,y=70)
auto_detect.current(0)


l = tk.StringVar()
choose_langauge = ttk.Combobox(root, width = 20, textvariable = l, state='readonly',font=('verdana',10,'bold'))


#list of languages
choose_langauge['values'] = ('Afrikaans','Albanian','Arabic','Armenian','Azerbaijani','Basque','Belarusian','Bengali','Bosnian',
'Bulgarian','Catalan','Cebuano','Chichewa','Chinese','Corsican','Croatian','Czech','Danish','Dutch',
'English','Esperanto','Estonian','Filipino','Finnish','French','Frisian','Galician','Georgian','German',
'Greek','Gujarati','Haitian Creole','Hausa','Hawaiian','Hebrew','Hindi','Hmong','Hungarian','Icelandic',
'Igbo','Indonesian','Irish','Italian','Japanese','Javanese','Kannada','Kazakh','Khmer','Kinyarwanda','Korean',
'Kurdish','Kyrgyz','Lao','Latin','Latvian','Lithuanian','Luxembourgish','Macedonian','Malagasy','Malay','Malayalam',
'Maltese','Maori','Marathi','Mongolian','Myanmar','Nepali','Norwegian','Odia','Pashto','Persian','Polish','Portuguese',
'Punjabi','Romanian','Russian','Samoan','Scots Gaelic','Serbian','Sesotho','Shona','Sindhi','Sinhala','Slovak',
'Slovenian','Somali','Spanish','Sundanese','Swahili','Swedish','Tajik','Tamil','Tatar','Telugu','Thai','Turkish',
'Turkmen','Ukrainian','Urdu','Uyghur','Uzbek','Vietnamese','Welsh','Xhosa','Yiddish','Yoruba','Zulu',)

choose_langauge.place(x=290,y=70)
choose_langauge.current(0)


t1 = Text(root,width=30,height=10,borderwidth=5,relief=RIDGE)
t1.place(x=10,y=100)

t2 = Text(root,width=30,height=10,borderwidth=5,relief=RIDGE)
t2.place(x=260,y=100)


button = Button(root,text="Translate",relief=RIDGE,borderwidth=3,font=('verdana',10,'bold'),cursor="hand2",command=translate)
button.place(x=150,y=280)


clear = Button(root,text="Clear",relief=RIDGE,borderwidth=3,font=('verdana',10,'bold'),cursor="hand2",command=clear)
clear.place(x=280,y=280)

root.mainloop()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.