Exemplo n.º 1
0
def login():
    if password == pinInput.value_text:
        pinError.fg = "green"
        pinError.value_text = "logging in..."
        os.sleep(1000)
        os.System("python screen.py")
    elif pinInput.value_text == "":
        pinError.fg = "red"
    elif pinInput.value_text != password:
        pinError.fg = "red"
        pinError.value_text = "password is incorrect!!!"
Exemplo n.º 2
0
         except:
             speak(
                 'Sorry harsh! I am unable to send your message at this moment!'
             )
 elif 'nothing' in query or 'abort' in query or 'stop' in query:
     speak('okay')
     speak('Bye harsh, have a good day.')
     sys.exit()
 elif 'search in chrome' in query:
     speak('what should i search?')
     chromepath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s"
     search = takecommand().lower()
     wb.get(chromepath).open_new_tab(search + '.com')
 elif 'logout' in query:
     speak('Logging out')
     os.System('shutdown -l')
 elif 'shutdown' in query:
     speak('Shutting down')
     os.System('shutdown /s /t 1')
 elif 'restart' in query:
     speak('Restarting p c')
     os.System('shutdown /r /t 1')
 elif 'play song' in query:
     song_dr = 'B:\\Songs'
     speak('Shall i play Lost in Japan')
     t = takecommand()
     songs = os.listdir(song_dr)
     if 'yes' in t:
         os.startfile(os.path.join(song_dr, songs[0]))
     else:
         os.startfile(os.path.join(song_dr, random.choice(songs)))
Exemplo n.º 3
0
    while jugada not in("a", "w", "s", "d"):
        os.system("cls")
        mostrar_tablero(tablero)
        jugada = input(" Mueve W-A-D-S -> ")
    else:
        if jugada == "d":
            tablero, movimientos = mover_derecha(tablero)
        elif jugada == "a":
            tablero, movimientos = mover_izquierda(tablero)
        elif jugada == "w":
            tablero, movimientos = mover_arriba(tablero)
        elif jugada == "s":
            tablero, movimientos = mover_abajo(tablero)
    
    # Si ganador es verdadero y mostrar ganador es falso entonces:
    if ganador(tablero) and not mostrar_ganado:
        mostrar_ganado = True
        os.System("cls")
        mostrar_tablero(tablero)
        print("------- GANASTE --------")
        op = input("Quieres Continuar? (s)")
        if op != "s":
            break

    if len(casillas_vacias(tablero)) == 0 and sin_movimientos(tablero) == True:
        print("------- PERDISTE --------")
        print("-------------------------")
        break

Exemplo n.º 4
0
def Doc_Control_Unit(doc, original_path, path_to_store):
    #define the folder to be sotred in
    newDir = path_to_store + '\\' + 'Documents'
    try:
        if not os.path.exists(newDir):
            os.makedirs(newDir)
    except OSError:
        print('Error')
    destination = newDir

    #Sort the type of Doc file
    if doc.endswith(".txt"):
        newDirTxt = destination + '\\' + 'Text'
        #creates new Folder for Text Documents if it is not created
        try:
            if not os.path.exists(newDirTxt):
                os.makedirs(newDirTxt)
        except OSError:
            print('Error')
        destination = newDirTxt
        #copy the files into the new destination
        shutil.move(original_path + '\\' + doc, destination)
        os.System("Close cmd")

    elif doc.endswith(".doc") or doc.endswith(".docx"):
        newDirDoc = destination + '\\' + 'Word Documents'
        #creates new Folder for Word Documents if it is not created
        try:
            if not os.path.exists(newDirDoc):
                os.makedirs(newDirDoc)
        except OSError:
            print('Error')
        destination = newDirDoc
        #copy the files into the new destination
        shutil.move(original_path + '\\' + doc, destination)

    elif doc.endswith(".ppt") or doc.endswith(".pptx"):
        newDirPpt = destination + '\\' + 'Power Points'
        #creates new Folder for PowerPoint Documents if it is not created
        try:
            if not os.path.exists(newDirPpt):
                os.makedirs(newDirPpt)
        except OSError:
            print('Error')
        destination = newDirPpt
        #copy the files into the new destination
        shutil.move(original_path + '\\' + doc, destination)

    elif doc.endswith(".xlsx") or doc.endswith("xls"):
        newDirXls = destination + '\\' + 'Excel Spreadsheets'
        # creates new Folder for Excel Documents if it is not created
        try:
            if not os.path.exists(newDirXls):
                os.makedirs(newDirXls)
        except OSError:
            print('Error')
        destination = newDirXls
        #copy the files into the new destination
        shutil.move(original_path + '\\' + doc, destination)
    else:
        destination = createFolder(destination, "Misc")
        shutil.move(original_path + '\\' + doc, destination)
Exemplo n.º 5
0
if (DateToRestore == datetime.now().date()):
    print "There is no backup for today."
    return

#restore current, as that will be necessary
CopyCommand = "cp -R " + BackupDir + "/" + rootDir + "/current/" + DirToRestore + " " + destDir
print "Copying latest backup information"
os.system(CopyCommand)

print "Calculating the incrementals to copy"
#get all the date directories in the incremental directory
incrementalDateStrings = os.listdir(BackupDir + "/" + rootDir + "/incremental")
incrementalDates = []

fileDateFormat = '%Y-%m-%d:%H:%M:%S'

for incDate in incrementalDateStrings:
    incrementalDates.append(datetime.datetime.strptime(incDate, fileDateFormat))

incrementalDates.sort(reverse=true)
CopyCommand1 = "rsync " + BackupDir + "/" + rootDir + "/incremental/"
CopyCommand2 = " " + DirToRestore
#calculate how many dates we need to copy
for date in incrementalDates :
    if (date.date() > DateToRestore):
        print("Restoring date " + date.date())
        os.System(CopyCommand1 + "date/" + date.strftime(fileDateFormat) + "/" + DirToRestore + " " + DirToRestore)


print("done")
'''
Created on Nov 4, 2018

@author: CAU VANG
'''
from gtts import gTTS
import time
import os

mytext = 'Tomorrow, and tomorrow, and tomorrow; creeps in this petty pace from day to day, until the last syllable of recorded time. And all our yesterdays have lighted fools the way to dusty'
#mytext = ' Tui là Trần Ngọc Tuyền. Lớp Khoa học máy tính 2015 '
# language in which you want to convert
language = 'en'
#language='vi'

myobj = gTTS(text=mytext, lang=language, slow=False)

# saving the converted audio in mp3 file named
# welcome
myobj.save("welcome1.mp3")

os.System("mpg321 welcome1.mp3")
Exemplo n.º 7
0
 def Not_Again(self):
     os.System("clear")
     print(" you have given  your vote sucessfully\n\n\n")
     print("you can't give your vote more than one time \n\n\n")
     mainlog()
Exemplo n.º 8
0
def hel():
    os.System(register.py)